[UPDATE PRIMITIVE] Accept singular file argument in codeql_bqrs_decode#303
Draft
Copilot wants to merge 4 commits into
Draft
[UPDATE PRIMITIVE] Accept singular file argument in codeql_bqrs_decode#303Copilot wants to merge 4 commits into
file argument in codeql_bqrs_decode#303Copilot wants to merge 4 commits into
Conversation
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix codeql_bqrs_decode to accept files array argument
[UPDATE PRIMITIVE] Accept singular Jun 20, 2026
file argument in codeql_bqrs_decode
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the codeql_bqrs_decode MCP server tool contract to accept a singular file argument (in addition to files), aligning the advertised schema with the existing registry normalization, and adds tests/docs plus a rebuilt server bundle.
Changes:
- Extend
codeql_bqrs_decodeinput schema to support optionalfileand optionalfiles. - Add a runtime guard for
codeql_bqrs_*tools to produce a clearer “file/files required” error when no BQRS path is provided. - Add unit + integration test coverage and update
CHANGELOG.md(plus rebuiltserver/distbundle).
Show a summary per file
| File | Description |
|---|---|
| server/src/tools/codeql/bqrs-decode.ts | Advertises file (singular) alongside files (plural) in the tool input schema. |
| server/src/lib/cli-tool-registry.ts | Adds a BQRS-tool guard error when no positional BQRS path is provided. |
| server/test/src/tools/codeql/bqrs-decode.test.ts | Adds schema-level tests to ensure both file and files parse. |
| server/test/src/lib/cli-tool-registry.test.ts | Adds handler-level tests for file/files normalization and missing-path error behavior. |
| client/integration-tests/primitives/tools/codeql_bqrs_decode/decode_singular_file/test-config.json | New integration test config exercising the singular file argument path. |
| client/integration-tests/primitives/tools/codeql_bqrs_decode/decode_singular_file/README.md | Documents the new integration test’s purpose/inputs/outputs. |
| client/integration-tests/primitives/tools/codeql_bqrs_decode/decode_singular_file/before/monitoring-state.json | New fixture (legacy) for integration test directory structure. |
| client/integration-tests/primitives/tools/codeql_bqrs_decode/decode_singular_file/after/monitoring-state.json | New fixture (legacy) for integration test directory structure. |
| server/dist/codeql-development-mcp-server.js | Rebuilt bundled server output reflecting the TypeScript changes. |
| CHANGELOG.md | Adds an Unreleased “Fixed” entry for the file vs files schema mismatch. |
Copilot's findings
- Files reviewed: 9/12 changed files
- Comments generated: 3
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Comment on lines
+250
to
+257
| if ( | ||
| name.startsWith('codeql_bqrs_') && | ||
| !positionalArgs.some(arg => typeof arg === 'string' && arg.trim() !== '') | ||
| ) { | ||
| throw new Error( | ||
| `The "${name}" tool requires a BQRS file path. Provide it via "file" (a single string path) or "files" (an array of string paths).`, | ||
| ); | ||
| } |
| }); | ||
|
|
||
| it('should have files as required positional input', () => { | ||
| it('should accept a singular file path via the files array input', () => { |
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.
📝 Update Information
Primitive Details
codeql_bqrs_decodeThis PR is for updating an existing MCP server primitive and must ONLY include these file types:
✅ ALLOWED FILES:
server/src/**/*.ts)server/src/tools/*.ts)server/test/**/*.ts)README.md, server docs)server/src/types/*.ts)server/src/lib/*.ts)package.json,tsconfig.json)🚫 FORBIDDEN FILES:
Rationale: This PR should contain only the files necessary to update and test the primitive.
🚨 PRs that include forbidden files will be rejected and must be revised.
🛑 MANDATORY PR VALIDATION CHECKLIST
BEFORE SUBMITTING THIS PR, CONFIRM:
Update Metadata
files(array) still works;file(string) now also accepted🎯 Changes Description
Current Behavior
codeql_bqrs_decodeadvertised only a required pluralfilesarray. Passing the singularfile— the common single-BQRS case and the natural first attempt for LLM clients — failed schema validation withmust have required property 'files', despite the registry handler already supportingfilefor allcodeql_bqrs_*tools. The advertised schema and the handler were out of sync.Updated Behavior
The tool accepts either
file(a single string path) orfiles(an array); both are optional and normalized to positional CLI args. When neither is supplied,codeql_bqrs_*tools now return an actionable error naming both parameters instead of a generic "required property" rejection.Motivation
Eliminate a recurring usability papercut and a common source of failed first attempts by automated/LLM clients; align the MCP-advertised contract with actual handler behavior.
🔄 Before vs. After Comparison
Functionality Changes
API Changes
Output Format Changes
// Unchanged — decoded BQRS output is identical regardless of which input form is used.🧪 Testing & Validation
Test Coverage Updates
Validation Scenarios
{ files: ["…"] }still parses and maps to positional args.{ file: "…" }parses through the enhanced schema and maps to positional args.fileandfiles.Test Results
decode_singular_filecase included).bqrsvia the singularfileargument📋 Implementation Details
Files Modified
server/src/tools/codeql/bqrs-decode.tsserver/src/lib/cli-tool-registry.tsserver/test/src/tools/codeql/bqrs-decode.test.ts,server/test/src/lib/cli-tool-registry.test.ts,client/integration-tests/primitives/tools/codeql_bqrs_decode/decode_singular_file/*CHANGELOG.mdCode Changes Summary
Dependencies
🔍 Quality Improvements
Bug Fixes (if applicable)
codeql_bqrs_decoderejected a singularfileargument, requiringfiles(array).files, while the registry handler already accepted singularfilefor BQRS tools — a schema/handler mismatch not bridged by existing camelCase/snake_case normalization.fileandfiles(optional) oncodeql_bqrs_decode; add a runtime guard forcodeql_bqrs_*that errors clearly when no path is provided.fileend-to-end.Performance Improvements
Code Quality Enhancements
🔗 References
Related Issues/PRs
External References
codeql bqrs decode -h -vv(CLI accepts one or more positional BQRS files)Validation Materials
decode_singular_fileintegration fixture decoding a real#selectBQRS via singularfile🚀 Compatibility & Migration
Backward Compatibility
Breaking Changes (if any)
None.
API Evolution
fileparameter addedfileandfilesfilescontract preserved👥 Review Guidelines
For Reviewers
Please verify:
Testing Instructions
Validation Checklist
filesarray path unchanged.filepath decodes successfully.distexercised.📊 Impact Assessment
Performance Impact
Server Impact
AI Assistant Impact
🔄 Deployment Strategy
Rollout Considerations
Post-Deployment Validation
Update Methodology: This update follows best practices: