Skip to content

fix(mcp): return file path and JSON schema instead of summary#47

Merged
sonesuke merged 1 commit intomainfrom
fix/mcp-return-schema
Feb 23, 2026
Merged

fix(mcp): return file path and JSON schema instead of summary#47
sonesuke merged 1 commit intomainfrom
fix/mcp-return-schema

Conversation

@sonesuke
Copy link
Owner

Summary

Change MCP tools to return structured response containing file path and JSON schema instead of a text summary. This allows LLMs to understand the file structure and use jq appropriately.

Problem

Previously, tools returned text summaries like "Found 10 papers:\nPaper Title 1\n...". This didn't help the LLM understand what fields were available in the output file for jq queries.

Solution

Return structured JSON with:

  • output_path: Path to the file containing the full results
  • schema: JSON schema describing the structure of the data in the file

Changes

  • search_papers: Returns {output_path, count, schema}
  • fetch_paper: Returns {output_path, schema}

Example Response

{
  "output_path": "/tmp/results.json",
  "count": 10,
  "schema": {
    "type": "array",
    "items": {
      "type": "object",
      "properties": {
        "id": {"type": "string"},
        "title": {"type": "string"},
        "authors": {"type": "array", "items": {"type": "string"}},
        ...
      }
    }
  }
}

The LLM can now:

  1. Read the file at output_path
  2. Use the schema to understand available fields
  3. Construct appropriate jq queries like jq '.[].title' /tmp/results.json

🤖 Generated with Claude Code

Change MCP tools to return structured response containing file path
and JSON schema instead of a text summary. This allows LLMs to
understand the file structure and use jq appropriately.

Changes:
- search_papers: Returns {output_path, count, schema}
- fetch_paper: Returns {output_path, schema}

The schema describes the JSON structure written to the file, making
it clear what fields are available for jq queries.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@sonesuke sonesuke merged commit 86fbda8 into main Feb 23, 2026
4 checks passed
@sonesuke sonesuke deleted the fix/mcp-return-schema branch February 23, 2026 11:07
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.

2 participants