PDX-468/469: feat(mcp): PROVAR_MCP_SCHEMA_MODE compact descriptions + PROVAR_MCP_TOOLS group filtering#170
Conversation
…tartup tuning (PDX-469) RCA: Agents with limited context windows hit budget limits on startup because full tool descriptions and schema metadata consume hundreds of tokens per tool. Customers also reported wasted context when only a subset of ProvarDX tools were relevant to their workflow (e.g. NitroX-only or automation-only sessions). Fix: Add PROVAR_MCP_SCHEMA_MODE=compact that switches all 19 tool descriptions to short summaries via desc() helper; add PROVAR_MCP_TOOLS env var that restricts which tool groups register at startup via TOOL_GROUPS + parseActiveGroups(). Covers nitrox, automation, qualityhub, validation, authoring, inspect, connection, rca groups. Add 13 unit tests and Agent performance tuning section in docs/mcp.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Quality Orchestrator🟢 LOW · 🧪 Tests to Run · Running 19 of 44 tests
▶ Run commandnpx vitest run \
unit/mcp/server.test.ts \
unit/mcp/antTools.test.ts \
unit/mcp/automationTools.test.ts \
unit/mcp/connectionTools.test.ts \
unit/mcp/defectTools.test.ts \
unit/mcp/nitroXTools.test.ts \
unit/mcp/pageObjectGenerate.test.ts \
unit/mcp/pageObjectValidate.test.ts \
unit/mcp/projectValidateFromPath.test.ts \
unit/mcp/propertiesTools.test.ts \
unit/mcp/qualityHubApiTools.test.ts \
unit/mcp/qualityHubTools.test.ts \
unit/mcp/rcaTools.test.ts \
unit/mcp/testCaseGenerate.test.ts \
unit/mcp/testCaseStepTools.test.ts \
unit/mcp/testCaseValidate.test.ts \
unit/mcp/testPlanTools.test.ts \
unit/mcp/testPlanValidate.test.ts \
unit/mcp/testSuiteValidate.test.ts
|
There was a problem hiding this comment.
Pull request overview
This PR tunes the ProvarDX MCP server startup footprint by (1) adding a “compact schema” mode that shortens tool/parameter descriptions and (2) allowing tool registration to be filtered by group via an environment variable, reducing initial handshake token usage.
Changes:
- Added
desc(standard, compact)helper and wrapped tool + Zod parameter descriptions across MCP tools forPROVAR_MCP_SCHEMA_MODE=compact. - Implemented tool-group registry +
PROVAR_MCP_TOOLSparsing increateProvarMcpServer()to conditionally register tool groups (withprovardx_pingalways present). - Added unit tests for compact mode and group parsing, and documented both new env vars + performance-tuning guidance.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/mcp/startupTuning.test.ts | Adds unit coverage for compact descriptions and PROVAR_MCP_TOOLS parsing behavior. |
| src/mcp/tools/descHelper.ts | Introduces desc() helper to switch between standard/compact strings at runtime. |
| src/mcp/server.ts | Adds tool-group registry, parseActiveGroups(), and group-filtered registration loop; updates ping description. |
| src/mcp/tools/testSuiteValidate.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/testPlanValidate.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/testPlanTools.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/testCaseValidate.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/testCaseStepTools.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/testCaseGenerate.ts | Wraps tool + parameter descriptions with desc(); reorders some schema fields while doing so. |
| src/mcp/tools/rcaTools.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/qualityHubTools.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/qualityHubApiTools.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/propertiesTools.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/projectValidateFromPath.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/projectInspect.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/pageObjectValidate.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/pageObjectGenerate.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/nitroXTools.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/defectTools.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/connectionTools.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/automationTools.ts | Wraps tool + parameter descriptions with desc(). |
| src/mcp/tools/antTools.ts | Wraps tool + parameter descriptions with desc(). |
| docs/mcp.md | Documents PROVAR_MCP_SCHEMA_MODE + PROVAR_MCP_TOOLS and adds performance-tuning section. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return new Set( | ||
| env | ||
| .split(',') | ||
| .map((g) => g.trim().toLowerCase()) | ||
| .filter(Boolean) | ||
| ); |
| .describe( | ||
| desc( | ||
| 'Minimum quality score for a test case to be considered valid (default: 80)', | ||
| 'int 0–100, optional; minimum quality score threshold' |
| PROVAR_MCP_SCHEMA_MODE=compact | ||
| ``` | ||
|
|
||
| When set to `compact`, every tool description and parameter description is replaced with a short summary (typically ≤15 words). This can save hundreds of tokens per tool in the initial context handshake, at the cost of reduced in-description guidance for the agent. |
| it('returns null when env var is empty string', () => { | ||
| process.env['PROVAR_MCP_TOOLS'] = ''; | ||
| assert.equal(parseActiveGroups(), null); | ||
| }); |
…--profile to smoke script RCA: parseActiveGroups returned an empty Set for inputs like PROVAR_MCP_TOOLS="," which caused no tool groups to register (silent outage). provardx_ping message param was not routed through desc(), making the docs/mcp.md claim "every parameter is replaced" inaccurate. quality_threshold compact desc said "int" but the Zod schema uses z.number(). Smoke script TOTAL_EXPECTED was hardcoded so --profile had no way to adjust the expected count for partial runs. Fix: parseActiveGroups now checks groups.size===0 post-filter and returns null (all groups) with a warn log. provardx_ping message routes through desc(). projectValidateFromPath quality_threshold compact desc changed from "int" to "number". docs/mcp.md line 484 softened from "every parameter" to "most". mcp-smoke.cjs gains --profile flag, inGroup() helper, PROVAR_MCP_TOOLS passthrough to server env, dynamic expectedCount, and group-conditional callTool wrappers. Adds desc() unit tests and "," / ",," edge cases to startupTuning.test.ts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s for PR #170 RCA: CLAUDE.md requires docs updates for env var and tool description changes; PR #170 added PROVAR_MCP_SCHEMA_MODE and PROVAR_MCP_TOOLS support with an overclaiming compact description sentence Fix: Changed tool descriptions and parameter descriptions to most tool and parameter descriptions to accurately reflect that provardx_ping message param is not routed through desc() helper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
RCA: Version bump required for the 1.5.1 release cycle covering PDX-468 through PDX-475. Fix: Update package.json and server.json to 1.5.1 in sync per CLAUDE.md convention. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
PROVAR_MCP_SCHEMA_MODE=compact— when set, every tool description switches to a short summary via a newdesc(standard, compact)helper. All 19 tool files wrapped (220 call sites). Saves hundreds of tokens per tool at handshake time.PROVAR_MCP_TOOLS=group1,group2— comma-separated list of tool groups to register at startup.provardx_pingalways registered. Groups: nitrox, automation, qualityhub, validation, authoring, inspect, connection, rca.Changes
src/mcp/tools/descHelper.ts— newdesc(standard, compact)helpersrc/mcp/server.ts— TOOL_GROUPS registry, parseActiveGroups() export, group-loop registrationtest/unit/mcp/startupTuning.test.ts— 13 unit tests (compact mode + group filtering)docs/mcp.md— env var table updated + new Agent performance tuning sectionTest plan
Generated with Claude Code