Skip to content

[FEATURE] Cypher-like graph query engine for MCP tool query_graph #9

@Wolfvin

Description

@Wolfvin

Problem

Agents currently must chain multiple MCP tools (trace -> impact -> context) to answer structural questions. Each hop costs tokens and round-trips. A single expressive query could replace 3-5 tool calls.

Proposed Change

Add a query_graph MCP tool that accepts an openCypher-subset query:

MATCH (f:Function)-[:CALLS]->(g) WHERE f.name = 'handleRequest' RETURN g.name, g.file
MATCH (c:Class)-[:INHERITS]->(p) WHERE p.name = 'BaseModel' RETURN c.name
MATCH (f:Function) WHERE NOT EXISTS { ()-[:CALLS]->(f) } RETURN f.name  -- dead code

Scope (minimal viable)

  • MATCH, WHERE, RETURN, LIMIT
  • Node labels + edge types
  • Basic predicates: =, CONTAINS, IS NULL, NOT EXISTS
  • Read-only (no write clauses)

Why This Matters for Agents

One query replaces: search -> trace -> filter -> format. Estimated 60-80% reduction in tool calls for structural questions. Agents can express precise intent instead of approximating with multiple tools.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions