Skip to content

Feature: list-survey-programs and list-survey-components#141

Open
luke-keller-census wants to merge 2 commits intomainfrom
feature/list-programs-components
Open

Feature: list-survey-programs and list-survey-components#141
luke-keller-census wants to merge 2 commits intomainfrom
feature/list-programs-components

Conversation

@luke-keller-census
Copy link
Copy Markdown
Member

This PR includes several commits that add list-survey-programs and list-survey-components tools to the MCP server. The initial commit adds underlying search functions, and following commits add the tools themselves. Both the list-survey-programs and list-survey-components tools are designed to replace list-datasets, which returns all 1,700 datasets, including years present, and other information, in favor of a streamlined flow that starts broad (listing all 30 programs) and narrows to specific components (requiring filtration) with richer metadata that should improve search-data-tables utilization and the selection of data based on fitness for the use case.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 11, 2026

Coverage Report for ./mcp-db

Status Category Percentage Covered / Total
🔵 Lines 97.11% (🎯 85%) 2959 / 3047
🔵 Statements 97.11% (🎯 85%) 2959 / 3047
🔵 Functions 99.34% (🎯 85%) 151 / 152
🔵 Branches 93.73% (🎯 85%) 464 / 495
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
mcp-db/migrations/1773071716018_create-programs-and-components-search-functions.ts 100% 80% 100% 100%
mcp-db/src/schema/components.schema.ts 100% 100% 100% 100%
mcp-db/src/schema/program.schema.ts 100% 100% 100% 100%
Generated in workflow #506 for commit 5ef1f77 by the Vitest Coverage Report Action

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 11, 2026

Coverage Report for ./mcp-server

Status Category Percentage Covered / Total
🔵 Lines 95.26% (🎯 85%) 1447 / 1519
🔵 Statements 95.26% (🎯 85%) 1447 / 1519
🔵 Functions 93.68% (🎯 85%) 89 / 95
🔵 Branches 93.01% (🎯 85%) 253 / 272
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
mcp-server/src/index.ts 96.42% 50% 25% 96.42% 38
mcp-server/src/schema/list-survey-programs.schema.ts 100% 100% 100% 100%
mcp-server/src/tools/list-survey-programs.tool.ts 85.29% 81.81% 100% 85.29% 63-66, 90-96
mcp-server/src/types/survey-program.types.ts 100% 100% 100% 100%
Generated in workflow #803 for commit 5ef1f77 by the Vitest Coverage Report Action

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR lays the database groundwork for new MCP discovery tools (list-survey-programs and list-survey-components) by adding SQL functions and new component metadata (frequency/frequency_notes), plus updating the shared programs/components CSV source.

Changes:

  • Adds a migration that creates list_survey_programs() and list_survey_components(program_string) SQL functions and adds components.frequency / components.frequency_notes.
  • Adds a migration unit test validating SQL escaping, NULL handling, and migration call order.
  • Updates mcp-db/data/components-programs.csv to include FREQUENCY and FREQUENCY_NOTES and refreshes the dataset list.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
mcp-db/migrations/1773071716018_create-programs-and-components-search-functions.ts Adds component columns, backfill SQL generation from CSV, and the two new SQL functions.
mcp-db/tests/migrations/1773071716018_create-programs-and-components-search-functions.test.ts Adds unit tests for SQL generation and migration sequencing.
mcp-db/data/components-programs.csv Adds frequency metadata columns and updates/condenses component rows.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Comment thread mcp-db/tests/seeds/configs/components.config.test.ts
Adds Components and Search functions to return data for the list-survey-programs and list-survey-components tools. Also adds new metadata to the Components table to reduce need to list out individual years data is available in.

* Update components-programs CSV with new metadata
* Add frequency and frequency_notes columns to Components
* Add partial seeding as a migration for Program description and new Component columns to ensure required data for new tools is present
* Create list-survey-programs function for returning all survey programs
* Create list-survey-components functions that filters Components by their Program.
Creates a list-survey-programs tool to assist with survey identification prior to fetch tool calls. This is part of a broader update to provide a set of tools that provide better context and richer details while improving token counts (compared to list-datasets).

* Create list-survey-programs tool for listing survey programs
* Add list-survey-programs tool to ToolRegistry for listing on start
* Update ES Lint rules to ignore unused vars starting with _
* Remove Searchable Field from Returned Programs
* Remove dist from lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants