Skip to content

IMP Label every MCP tool result as recorded data - #65

Merged
allrude merged 1 commit into
mainfrom
imp/mcp-recorded-data-for-tools
Oct 31, 2026
Merged

allrude merged 1 commit into
mainfrom
imp/mcp-recorded-data-for-tools

Conversation

@allrude

@allrude allrude commented Oct 31, 2026

Copy link
Copy Markdown
Member

Fixes 64.

Cause

The recorded_data note was part of McpProfilePresenter::envelope(). A tool from another module builds its own envelope, so its results reached the agent without the warning. Found while reviewing the Commerce365 add-on, whose two tools return Hub and Business Central bodies.

Fix

  • Mcp\Server::callTool() adds the note, right after status, to every successful result that has none. A tool that sets its own keeps it; an error result gets none.
  • McpProfilePresenter::RECORDED_DATA_NOTE is public so the server uses the same words.
  • Developer guide says so, HTML regenerated.

Checks

  • 3 new ServerTest cases: the note and its position on a plain tool result, a tool's own note kept, no note on an error.
  • PHPUnit: 424 tests OK. PHPStan and phpcs clean on the changed files.

The recorded_data note lived in the presenter's envelope, so a tool
another module adds, building its own envelope, reached the agent
without it. The server now adds it to every successful result that
does not carry one.
@allrude
allrude merged commit 1b017ee into main Oct 31, 2026
5 checks passed
@allrude
allrude deleted the imp/mcp-recorded-data-for-tools branch October 31, 2026 14:29
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