Skip to content

Commit d21f47a

Browse files
Copilotdata-douser
andauthored
Add sarif_list_rules response format documentation to server-tools.md
Document the per-rule resultCount field and complete response schema in the MCP resource file served to LLMs at runtime. Includes JSON example, top-level field descriptions, and per-rule field reference with types and required/optional markers. Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/c1d03a5c-2041-41bb-a120-365ddf420c5b Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
1 parent 22c582b commit d21f47a

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

server/src/resources/server-tools.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,50 @@ This resource provides a complete reference of the default tools exposed by the
6868
| `sarif_compare_alerts` | Compare code locations of two SARIF alerts for overlap (sink, source, any-location, full-path modes) |
6969
| `sarif_diff_runs` | Diff two SARIF files to find added, removed, and changed rules/results across analysis runs |
7070

71+
### `sarif_list_rules` Response Format
72+
73+
Returns a JSON object with per-rule result counts and metadata:
74+
75+
```json
76+
{
77+
"totalRules": 3,
78+
"totalResults": 15,
79+
"rules": [
80+
{
81+
"ruleId": "js/sql-injection",
82+
"resultCount": 8,
83+
"name": "Database query built from user-controlled sources",
84+
"kind": "path-problem",
85+
"precision": "high",
86+
"severity": "8.8",
87+
"tags": ["security", "external/cwe/cwe-089"],
88+
"tool": "CodeQL",
89+
"toolVersion": "2.20.4"
90+
}
91+
]
92+
}
93+
```
94+
95+
| Field | Type | Description |
96+
| -------------- | ------ | ------------------------------------------------ |
97+
| `totalRules` | number | Total number of distinct rules in the SARIF file |
98+
| `totalResults` | number | Sum of `resultCount` across all rules |
99+
| `rules[]` | array | Per-rule summaries (see below) |
100+
101+
Each rule object:
102+
103+
| Field | Type | Required | Description |
104+
| ------------- | -------- | -------- | ---------------------------------------------------------------------------- |
105+
| `ruleId` | string | yes | Rule identifier (matches the CodeQL query `@id`) |
106+
| `resultCount` | number | yes | Number of results (findings) for this rule. `0` if defined but not triggered |
107+
| `name` | string | no | Display name (from `shortDescription.text`, `name`, or `id`) |
108+
| `kind` | string | no | Query kind (`path-problem`, `problem`, etc.) |
109+
| `precision` | string | no | Precision level (`high`, `medium`, `low`, `very-high`) |
110+
| `severity` | string | no | Security severity score (from `security-severity` property) |
111+
| `tags` | string[] | no | Rule tags (e.g., `security`, `external/cwe/cwe-089`) |
112+
| `tool` | string | no | Tool driver name (e.g., `CodeQL`) |
113+
| `toolVersion` | string | no | Tool driver version |
114+
71115
## Common Tool Workflows
72116

73117
### Create and Test a Query

0 commit comments

Comments
 (0)