Skip to content

feat: generate an MCP tool manifest from the enriched catalog#6

Open
estebanzimanyi wants to merge 1 commit into
masterfrom
feat/mcp-generator
Open

feat: generate an MCP tool manifest from the enriched catalog#6
estebanzimanyi wants to merge 1 commit into
masterfrom
feat/mcp-generator

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

What

Adds generator/mcp.py + generate_mcp.py: projects the enriched MEOS
catalog onto a Model Context Protocol tool manifest, so an LLM/agent can
call the MEOS spatiotemporal value algebra directly.

python run.py                 # enriched catalog -> output/meos-idl.json
python generate_mcp.py        #              -> output/meos-mcp.json

How

  • One MCP tool per stateless-exposable function.
  • Self-contained inputSchema (JSON Schema 2020-12): enums and
    opaque-type schemas are inlined, since MCP clients don't resolve
    external $refs (this is why it's a separate generator from the OpenAPI
    one — same model, different rendering).
  • Spatiotemporal values pass as serialized strings; each parameter
    description names the type and its encodings (text/WKT, MF-JSON, HexWKB)
    so the model formats them correctly.
  • annotations mark tools read-only/idempotent;
    x-meos.{category,decode,encode} give a runtime everything to dispatch a
    call with no extra metadata.
  • Pure dictdict (no libclang, no MEOS runtime); deterministic
    (tools sorted by name).

Validation

Run against the live MobilityDB master catalog: 2672 functions →
1790 tools
(1743 with outputSchema, 47 void), names unique & sorted,
0 malformed. tests/test_mcp.py: 7 stdlib unittest cases, all green.
Contract and roadmap in docs/mcp.md.

Scope / dependency

Logically stacks on the catalog-enrichment work (consumes the
network / wire / typeEncodings fields); sibling to the OpenAPI
generator. Delivers the manifest, not an MCP server — a generated
stdio/HTTP server (decode → call → encode) is the natural next unit.

Adds generator/mcp.py + generate_mcp.py: projects the enriched MEOS catalog (network/wire/typeEncodings) onto a Model Context Protocol tool manifest, so an LLM/agent can call the MEOS value algebra directly.

- one MCP tool per stateless-exposable function
- self-contained inputSchema (JSON Schema 2020-12); enums and opaque
  types inlined, since MCP clients don't resolve external $refs
- spatiotemporal values passed as serialized strings; descriptions
  state the encodings so the model formats them correctly
- annotations (readOnly/idempotent), x-meos.{category,decode,encode}
  give a runtime everything to dispatch without extra metadata
- pure dict -> dict, deterministic (tools sorted by name)

Logically depends on the catalog being enriched. Validated against the
live MobilityDB master catalog: 2672 functions -> 1790 tools, all
well-formed. Documented in docs/mcp.md; tested in tests/test_mcp.py
(stdlib unittest).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant