fix(mcp): surface structured data in text-only tool responses - #449
Merged
Conversation
capabilities, upload_list/status/cancel, upload_file mint mode (and vault_put_file mint mode) emitted only stub prose in the Text channel while putting real data in StructuredContent. Plain-text MCP clients read only Text, so they received no actionable data (transport/source modes, upload handles, presigned URLs, curl commands). Route these results through toolargs.ResultJSONText so Text carries the same canonical JSON as StructuredContent, matching the existing mcp-result-envelope convention. Add tests asserting text-only clients receive the data.
This comment has been minimized.
This comment has been minimized.
Code Coverage ReportTotal Coverage: 51.7% Generated from commit: da527ff |
The capabilities tool no longer returns the 'Pinner capabilities.' stub in the text channel; text now carries the same report JSON as the structured payload. Update the e2e assertion to match.
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes MCP audit findings where several tools returned only stub prose in the
Textchannel while placing real data inStructuredContent. Plain-text MCP clients (which read onlyText) received no actionable data.Affected tools:
capabilities— now returns transport + source_modes + download_sink_modes JSON in Textupload_list/upload_status/upload_cancel/upload_file_async— handles & status now in Textupload_file(mint mode) — actual presignedurl+curl_commandnow in Text (theupload_handleitself is only produced by the presigned PUT's 202 response, so it can't appear at mint time; the tool now says where to get it and which tool to poll)vault_put_file(mint mode) and theipfs_upload_submitapp helper — same treatmentApproach
Route results through the existing
toolargs.ResultJSONTextconvention soTextcarries the same canonical JSON asStructuredContent, matching the established mcp-result-envelope contract.Tests
go build ./...cleaninternal/mcp,upload,vault,core/transferThis pull request improves how MCP tool responses handle text-only clients by ensuring that structured data is also included in the text channel of tool results.
Problem: Several MCP tools (capabilities, upload-file, vault-put-file, IPFS upload, and async upload tools) returned their actionable data only in the
StructuredContentfield, while theTextfield contained either a brief stub message (e.g., "Pinner capabilities." or "Upload status.") or prose instructions without the actual data. Text-only MCP clients that don't render structured content widgets would miss crucial information like presigned URLs, curl commands, and upload handles.Changes:
upload_file_async,upload_status,upload_cancel,upload_list): All now embed the relevant data (handle, task status, cancellation confirmation, tracked uploads list) as JSON in the text channel instead of bare stubs.This ensures that clients relying solely on text output receive complete, actionable information for performing uploads and checking their status.