Skip to content

Commit 583bad4

Browse files
committed
fixes for broken tools, integrations tests, & docs
Fixes found by stress-testing MCP tools against real CodeQL databases: - bqrs_decode: replace non-existent --max-results/--max-paths with correct --rows option; add --result-set, --entities, --sort-direction, --no-titles - bqrs_info: add --format (text/json), --paginate-rows, --paginate-result-set; fix format passthrough in cli-tool-registry (formatShouldBePassedToCLI) - list_query_run_results: add language/queryPath filters; extract metadata from query.log (queryPath, databasePath, language); add fallback language detection from semmlecode.<lang>.dbscheme and codeql/<lang>-all/ paths - database_analyze: add --rerun parameter; auto-create output parent directory to prevent NoSuchFileException after long-running evaluations - query_run: fix SARIF generation to use interpretBQRSFile with proper -t metadata instead of bare bqrs interpret; fix output filename to results-interpreted.sarif - `docs/**/*.md`: update project docs to reflect ^ improvements to tools. Unit tests: 873 passed (44 files, +23 new tests) Integration tests: 5 new test cases covering each fix
1 parent 84faf53 commit 583bad4

File tree

37 files changed

+1055
-382
lines changed

37 files changed

+1055
-382
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# `codeql_bqrs_decode` - decode_with_result_set
2+
3+
## Purpose
4+
5+
Tests the `codeql_bqrs_decode` tool with the `result-set` parameter to decode
6+
a specific result set from a BQRS file. This test exercises the `--result-set`,
7+
`--format`, and `--no-titles` CLI options which were previously untested,
8+
allowing non-existent options like `--max-results` to go undetected.
9+
10+
## Inputs
11+
12+
- `before/results.bqrs` — BQRS file with a `#select` result set (1 row, 2 columns).
13+
- `test-config.json` — Specifies `result-set`, `format`, and `no-titles` arguments.
14+
15+
## Outputs
16+
17+
- Tool returns decoded CSV output for the `#select` result set without column headers.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"sessions": [
3+
{
4+
"id": "integration_test_session",
5+
"calls": [
6+
{
7+
"tool": "codeql_bqrs_decode",
8+
"timestamp": "2025-09-25T16:06:00.000Z",
9+
"status": "success"
10+
}
11+
]
12+
}
13+
]
14+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"sessions": []
3+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"toolName": "codeql_bqrs_decode",
3+
"arguments": {
4+
"files": ["client/integration-tests/primitives/tools/codeql_bqrs_decode/decode_with_result_set/before/results.bqrs"],
5+
"format": "csv",
6+
"result-set": "#select",
7+
"no-titles": true
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# `codeql_bqrs_info` - json_format
2+
3+
## Purpose
4+
5+
Tests the `codeql_bqrs_info` tool with `format=json` to get machine-readable
6+
output. This test exercises the `--format` CLI option being passed through to
7+
the CLI correctly — previously `format` was silently swallowed by the tool
8+
registry and not passed to `codeql bqrs info`, causing quiet fallback to text
9+
format.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"sessions": [
3+
{
4+
"id": "integration_test_session",
5+
"calls": [
6+
{
7+
"tool": "codeql_bqrs_info",
8+
"timestamp": "2025-09-25T16:06:00.000Z",
9+
"status": "success"
10+
}
11+
]
12+
}
13+
]
14+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"sessions": []
3+
}
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"toolName": "codeql_bqrs_info",
3+
"arguments": {
4+
"files": ["client/integration-tests/primitives/tools/codeql_bqrs_info/json_format/before/results.bqrs"],
5+
"format": "json"
6+
}
7+
}

0 commit comments

Comments
 (0)