Perform JSON Schema input validation of MCP requests#907
Conversation
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
🤖 Augment PR SummarySummary: This PR adds JSON Schema–driven validation for MCP/JSON-RPC request inputs by validating each tool’s Changes:
Technical Notes: RPC input schemas (e.g., 🤖 Was this summary useful? React with 👍 or 👎 |
| if (!arguments.defines("schema") || !arguments.at("schema").is_string() || | ||
| !arguments.defines("instance")) { | ||
| // TODO: Cache the compiled template across invocations | ||
| const auto rpc_schema_template{this->blaze_template( |
There was a problem hiding this comment.
src/actions/action_jsonschema_evaluate_v1.h:79: this->blaze_template(this->rpc_schema_, ...) will assert/throw if rpcSchema wasn’t provided by the router (or the corresponding metapack is missing/corrupt), which would turn a request-time input-validation step into a process-terminating failure. Is that failure mode intended for runtime request handling, or should it degrade to an InvalidParams-style error?
Severity: medium
Other Locations
src/actions/action_jsonschema_trace_v1.h:81src/actions/action_schema_search_v1.h:172src/actions/action_serve_explorer_artifact_v1.h:70src/actions/action_serve_schema_artifact_v1.h:74
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
There was a problem hiding this comment.
Benchmark Index (community)
Details
| Benchmark suite | Current: f0834bb | Previous: a0983a2 | Ratio |
|---|---|---|---|
Add one schema (0 existing) |
240 ms |
242 ms |
0.99 |
Add one schema (100 existing) |
25 ms |
23 ms |
1.09 |
Add one schema (1000 existing) |
85 ms |
76 ms |
1.12 |
Add one schema (10000 existing) |
683 ms |
942 ms |
0.73 |
Update one schema (1 existing) |
18 ms |
23 ms |
0.78 |
Update one schema (101 existing) |
25 ms |
24 ms |
1.04 |
Update one schema (1001 existing) |
98 ms |
75 ms |
1.31 |
Update one schema (10001 existing) |
693 ms |
623 ms |
1.11 |
Cached rebuild (1 existing) |
5 ms |
5 ms |
1 |
Cached rebuild (101 existing) |
7 ms |
7 ms |
1 |
Cached rebuild (1001 existing) |
30 ms |
26 ms |
1.15 |
Cached rebuild (10001 existing) |
270 ms |
274 ms |
0.99 |
Index 100 schemas |
111 ms |
142 ms |
0.78 |
Index 1000 schemas |
947 ms |
1082 ms |
0.88 |
Index 10000 schemas |
17438 ms |
13546 ms |
1.29 |
This comment was automatically generated by workflow using github-action-benchmark.
There was a problem hiding this comment.
Benchmark Index (enterprise)
Details
| Benchmark suite | Current: f0834bb | Previous: a0983a2 | Ratio |
|---|---|---|---|
Add one schema (0 existing) |
232 ms |
230 ms |
1.01 |
Add one schema (100 existing) |
26 ms |
27 ms |
0.96 |
Add one schema (1000 existing) |
79 ms |
84 ms |
0.94 |
Add one schema (10000 existing) |
693 ms |
803 ms |
0.86 |
Update one schema (1 existing) |
20 ms |
20 ms |
1 |
Update one schema (101 existing) |
27 ms |
27 ms |
1 |
Update one schema (1001 existing) |
78 ms |
84 ms |
0.93 |
Update one schema (10001 existing) |
664 ms |
686 ms |
0.97 |
Cached rebuild (1 existing) |
6 ms |
7 ms |
0.86 |
Cached rebuild (101 existing) |
8 ms |
9 ms |
0.89 |
Cached rebuild (1001 existing) |
28 ms |
31 ms |
0.90 |
Cached rebuild (10001 existing) |
243 ms |
269 ms |
0.90 |
Index 100 schemas |
116 ms |
114 ms |
1.02 |
Index 1000 schemas |
1023 ms |
1022 ms |
1.00 |
Index 10000 schemas |
14332 ms |
14180 ms |
1.01 |
This comment was automatically generated by workflow using github-action-benchmark.
Signed-off-by: Juan Cruz Viotti jv@jviotti.com