Skip to content

Commit 21ab5d3

Browse files
committed
Integration tests for read_database_source tool
Adds client integration tests for the new 'read_database_source' MCP server tool.
1 parent 1b02f68 commit 21ab5d3

File tree

14 files changed

+57563
-4828
lines changed

14 files changed

+57563
-4828
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# `read_database_source` - list_source_files
2+
3+
## Purpose
4+
5+
Tests the `read_database_source` tool in listing mode by omitting `filePath` to list all source files in a CodeQL database source archive.
6+
7+
## Inputs
8+
9+
- **database**: Path to the JavaScript example test database
10+
11+
## Expected Behavior
12+
13+
The tool should return a listing of all source files in the database's `src/` directory, including `totalEntries`, `returnedEntries`, and `truncated` metadata.
14+
15+
## Static Files Referenced
16+
17+
- `server/ql/javascript/examples/test/ExampleQuery1/ExampleQuery1.testproj`
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": "read_database_source",
8+
"timestamp": "2025-09-25T16:06:00.000Z",
9+
"status": "success"
10+
}
11+
]
12+
}
13+
]
14+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sessions": [],
3+
"parameters": {
4+
"databasePath": "server/ql/javascript/examples/test/ExampleQuery1/ExampleQuery1.testproj"
5+
}
6+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# `read_database_source` - read_source_file
2+
3+
## Purpose
4+
5+
Tests the `read_database_source` tool in file-read mode by requesting a specific source file from a CodeQL database source archive.
6+
7+
## Inputs
8+
9+
- **database**: Path to the JavaScript example test database
10+
- **filePath**: Path to a source file within the database archive
11+
12+
## Expected Behavior
13+
14+
The tool should return the contents of the requested source file along with metadata including `entryPath`, `sourceType`, `totalLines`, `startLine`, and `endLine`.
15+
16+
## Static Files Referenced
17+
18+
- `server/ql/javascript/examples/test/ExampleQuery1/ExampleQuery1.testproj`
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": "read_database_source",
8+
"timestamp": "2025-09-25T16:06:00.000Z",
9+
"status": "success"
10+
}
11+
]
12+
}
13+
]
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sessions": [],
3+
"parameters": {
4+
"databasePath": "server/ql/javascript/examples/test/ExampleQuery1/ExampleQuery1.testproj",
5+
"filePath": "ExampleQuery1.js"
6+
}
7+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[2026-01-20 15:00:00] [SPAMMY] execute query-server2> runQuery called with /workspace/src/SqlInjection.ql
2+
[2026-01-20 15:00:01] Calling plumbing command: codeql resolve upgrades --dbscheme=/databases/test-python-db/db-python/semmlecode.python.dbscheme --format=json

0 commit comments

Comments
 (0)