Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Fix ingest_traces array schema missing items property

Bing Ho89970f2b3ee0
diff --git a/src/mcp/mcp.c b/src/mcp/mcp.c
index 55b99b6f3..8a9a0329f 100644
--- a/src/mcp/mcp.c
+++ b/src/mcp/mcp.c
@@ -304,7 +304,8 @@ static const tool_def_t TOOLS[] = {
"\"sections\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}}}"},
{"ingest_traces", "Ingest runtime traces to enhance the knowledge graph",
- "{\"type\":\"object\",\"properties\":{\"traces\":{\"type\":\"array\"},\"project\":{\"type\":"
+ "{\"type\":\"object\",\"properties\":{\"traces\":{\"type\":\"array\",\"items\":{\"type\":"
+ "\"object\"}},\"project\":{\"type\":"
"\"string\"}},\"required\":[\"traces\"]}"},
};
diff --git a/tests/test_mcp.c b/tests/test_mcp.c
index 187170b16..9fd069015 100644
--- a/tests/test_mcp.c
+++ b/tests/test_mcp.c
@@ -129,6 +129,35 @@ TEST(mcp_tools_list) {
PASS();
}
+TEST(mcp_tools_array_schemas_have_items) {
+ /* VS Code 1.112+ rejects array schemas without "items" (see
+ * https://github.com/microsoft/vscode/issues/248810).
+ * Walk every tool's inputSchema and verify that every "type":"array"
+ * property also contains "items". */
+ char *json = cbm_mcp_tools_list();
+ ASSERT_NOT_NULL(json);
+
+ /* Scan for all occurrences of "type":"array" — each must be followed
+ * by "items" before the next closing brace of that property. */
+ const char *p = json;
+ while ((p = strstr(p, "\"type\":\"array\"")) != NULL) {
+ /* Find the enclosing '}' for this property object */
+ const char *end = strchr(p, '}');
+ ASSERT_NOT_NULL(end);
+ /* "items" must appear between p and end */
+ size_t span = (size_t)(end - p);
+ char *segment = malloc(span + 1);
+ memcpy(segment, p, span);
+ segment[span] = '\0';
+ ASSERT_NOT_NULL(strstr(segment, "\"items\"")); /* array missing items */
+ free(segment);
+ p = end;
+ }
+
+ free(json);
+ PASS();
+}
+
TEST(mcp_text_result) {
char *json = cbm_mcp_text_result("{\"total\":5}", false);
ASSERT_NOT_NULL(json);
@@ -1198,6 +1227,7 @@ SUITE(mcp) {
/* MCP protocol helpers */
RUN_TEST(mcp_initialize_response);
RUN_TEST(mcp_tools_list);
+ RUN_TEST(mcp_tools_array_schemas_have_items);
RUN_TEST(mcp_text_result);
RUN_TEST(mcp_text_result_error);