Multiple backend changes to make use of the new mcp tools and improve… - #440
Open
miss-o-soup wants to merge 8 commits into
Open
Multiple backend changes to make use of the new mcp tools and improve…#440miss-o-soup wants to merge 8 commits into
miss-o-soup wants to merge 8 commits into
Conversation
… text in the cards Updated Fallbacks for Data Facets (src/server/steps/observations.ts): Dataset Source: Changed fallback from 'Data Commons' to an empty string '' (meta?.source || data.importName || ''). When neither metadata nor API import names exist, it now cleanly defaults to empty instead of injecting generic filler. Units: Changed default fallback for un-unitized variables from 'Dimensionless' to 'Unit not specified' (data.unit || 'Unit not specified'). Integration of Updated Data Commons MCP Tools & Remote Playbooks: Metadata Resolution (observations.ts): Concurrently query get_variable_metadata via MCP during time-series fetching to map exact dataset provenance names (isPartOf, source, url). Remote MCP Skill Playbooks (src/server/clients/mcp.ts & src/server/steps/data_discovery.ts): Implemented readMcpResource via JSON-RPC resources/read to dynamically fetch and inject remote playbooks (skill://data-commons-researcher/SKILL.md) into Gemini's system instruction. Data Discovery Skill Rules & Lead-in Prompts (data_discovery.md): Rule 0 (Strict Verbatim Copying): Mandated copying variable DCIDs and names verbatim from MCP search outputs, prohibiting inferred/invented demographic labels and enforcing places_with_data verification. Rule 0.1 (Lead-in Intro Rules): Constrained the table card introduction to a 1-sentence framing description (12–22 words) explicitly attributing data to "Data Commons", following John Saito tone guidelines, and utilizing dynamic variation patterns (Patterns A–D). Data Comparison Skill Prompt (data_comparison.md): Updated comparative insights schema instructions to produce clean, standalone plain-text comparative sentences across places.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces MCP skill playbook fetching and caching, refines LLM prompt instructions and schemas across several markdown files, and integrates concurrent metadata retrieval from MCP in fetchTimeSeries to enrich observation facets. The review feedback highlights critical improvements: caching negative results in fetchMcpSkillPlaybook to avoid repeated timeout delays, wrapping metadata parsing in a try-catch block to prevent parsing errors from breaking successful observation fetches, and correcting minor typographical errors in the query analyzer prompt.
…ke these descriptions and fallbacks more flexible in cases of incomplete parts (or in the case of dates, duplicate dates, to prevent 2020-2020, etc).
…ultiple variables
…nting an abort of shared in-flight fetches) and omit fallback text for unspecified units (the latter so that a lengthy indicator that there are no units doesn't take up a large amount of space in the facet description).
nick-nlb
marked this pull request as ready for review
August 18, 2026 01:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backend, MCP Integration, Skills & Data Access
Updated Fallbacks for Data Facets (src/server/steps/observations.ts):
Integration of Updated Data Commons MCP Tools & Remote Playbooks:
Data Discovery Skill Rules & Lead-in Prompts (data_discovery.md):
Data Comparison Skill Prompt (data_comparison.md):
BEFORE - The true facet information was missing defaulting to say Data Commons

AFTER - Now the true facet info from the metadata mcp tool is being used and displayed
