Skip to content

[PERF] Token-efficient output: structured compact format for all MCP tools #17

@Wolfvin

Description

@Wolfvin

Problem

Several MCP tools return verbose JSON with redundant fields. Agents pay tokens for every byte of output. At scale (large codebases), a single trace call can return 5-10KB of JSON when 500 bytes would suffice.

Proposed Changes

1. Add --compact / format: 'compact' to all MCP tools
Strip file paths to relative, omit null fields, abbreviate edge labels (C=CALLS, I=IMPORTS).

2. Pagination on all list-type tools
Add limit + offset params to search, list, trace (with max_depth). Default limit=20, agents can request more if needed.

3. get_graph_schema tool
Returns node/edge counts, labels present, property keys — lets agents understand the shape of the graph in one cheap call before issuing queries.

4. Structured summary in get_architecture
Return: language breakdown, entry points, top-N hotspot files, package count. One call that answers 'what is this codebase' without reading any files.

Target

5 structural queries should cost <5k tokens total. Currently the same queries cost 30-80k tokens due to verbose output + large payloads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions