Summary
The MCP schema for extract_facts declares entity_hints as an array but does not declare an items schema. Strict OpenAI-compatible tool validators reject this before the model runs.
Location
src/core/operations.ts:
entity_hints: {
type: 'array',
description: 'Existing canonical entity slugs the agent has already resolved. Helps the extractor pick the right slug.'
}
src/mcp/tool-defs.ts only emits items when the operation param has v.items, so the generated MCP tool schema also lacks items.
Observed error
When GBrain is exposed as an MCP server to Hermes using an OpenAI Codex backend, the whole request is rejected with:
HTTP 400: Invalid schema for function 'mcp_gbrain_extract_facts':
In context=('properties', 'entity_hints'), array schema missing items.
param: tools[10].parameters
code: invalid_function_parameters
Reproduction
- Build MCP tool definitions from
operations.
- Inspect
extract_facts.inputSchema.properties.entity_hints.
- It is emitted as:
{
"type": "array",
"description": "Existing canonical entity slugs the agent has already resolved. Helps the extractor pick the right slug."
}
Expected behavior
Array parameters should include an items schema. For this field, the values are canonical entity slug strings, so the schema should be:
entity_hints: {
type: 'array',
items: { type: 'string' },
description: 'Existing canonical entity slugs the agent has already resolved. Helps the extractor pick the right slug.'
}
Suggested regression check
Add a test that every MCP-facing operation parameter with type: 'array' produces a tool schema containing items. This prevents future strict tool validators from rejecting the whole MCP tool list because of one malformed array parameter.
Summary
The MCP schema for
extract_factsdeclaresentity_hintsas an array but does not declare anitemsschema. Strict OpenAI-compatible tool validators reject this before the model runs.Location
src/core/operations.ts:src/mcp/tool-defs.tsonly emitsitemswhen the operation param hasv.items, so the generated MCP tool schema also lacksitems.Observed error
When GBrain is exposed as an MCP server to Hermes using an OpenAI Codex backend, the whole request is rejected with:
Reproduction
operations.extract_facts.inputSchema.properties.entity_hints.{ "type": "array", "description": "Existing canonical entity slugs the agent has already resolved. Helps the extractor pick the right slug." }Expected behavior
Array parameters should include an
itemsschema. For this field, the values are canonical entity slug strings, so the schema should be:Suggested regression check
Add a test that every MCP-facing operation parameter with
type: 'array'produces a tool schema containingitems. This prevents future strict tool validators from rejecting the whole MCP tool list because of one malformed array parameter.