Skip to content

Stop emitting redundant filename/slug fields in MCP read-tool responses #3

Description

@ivklgn

Problem

The document model serializes filename and slug on every row the read tools return, without omitempty. Both are derivable from path, which is already present. The list_documents description does not mention them, so only the wire payload carries the redundancy.

The struct moved in v0.7.0: it is docs.Document in internal/docs/document.go (aliased as LocalDocument in internal/mcp/tools/docs_bridge.go), not internal/mcp/tools/common.go.

Internal consumers — already checked

Both fields are read inside the binary, so they cannot be deleted outright:

  • Sluginternal/advisory/code_alignment.go, which turns a slug into search tokens
  • Filenamecmd/status.go, in the naming check

The change is therefore json:"-" on both fields, keeping the Go fields in place.

Expected result

Read-tool JSON payloads omit filename and slug. The Go struct keeps them for internal use.

Impact

~430 tokens per 50 documents on list_documents and search_documents — among the most frequently called tools. Item 2 in .archcore/cli/mcp-token-optimization.idea.md.

Scope

  • Mark both fields json:"-" in internal/docs/document.go.
  • Check search_documents and get_document for their own copies of the fields in response structs.
  • Update the output-shape tests, and the examples/ fixtures if they pin the payload.

Files: internal/docs/document.go (+ list/search/get tests)

Acceptance: read-tool payloads omit filename and slug, and the integration suite passes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    mcpMCP server and tools

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions