8000 refactor(mcp): convert tool results with pi-mcp's toLlmContent by geminixiang · Pull Request #161 · geminixiang/mikan · GitHub
[go: up one dir, main page]

Skip to content

refactor(mcp): convert tool results with pi-mcp's toLlmContent - #161

Merged
geminixiang merged 1 commit into
mainfrom
refactor/mcp-to-llm-content
Oct 9, 2026
Merged

geminixiang merged 1 commit into
mainfrom
refactor/mcp-to-llm-content

Conversation

@geminixiang
Copy link
Copy Markdown
Owner

MCP tool results are converted to model content with pi-mcp's toLlmContent instead of mikan's own block conversion (-90 lines). mikan keeps only the (empty result) placeholder, because a provider can reject a tool result with no content; truncation, digest, and spill are unchanged.

Eval (MCP stdio server returning each shape, read through loadMcpTools as the model sees it)

Shape main this branch
text, image unchanged unchanged
embedded image resource [Resource: … binary content omitted] the image
embedded text resource [Resource: uri] + text the text
binary resource, audio, resource link mikan wording pi-mcp wording
structured content only {"a":1} {"a":1}
empty (empty result) (empty result)
error, 90 KB result (truncated with spill notice) unchanged unchanged

Verification

  • Failing test first: an embedded image resource reaches the model as an image.
  • Full gate.
  • Local daemon on a test Slack workspace with a deferred MCP server: the model called the tool for an embedded PNG resource; the stored tool result holds the image block, the same as for a plain MCP image. (The test model could not see either image, which is the model's limit, not this change.)

mikan converted MCP content blocks to model content itself. pi-mcp's toLlmContent does the same and passes an image embedded as a resource through as an image, which mikan replaced with a placeholder line. Only the empty-result placeholder stays, because a provider can reject a tool result with no content.
@geminixiang
geminixiang merged commit 99f3f11 into main Oct 9, 2026
3 checks passed
@geminixiang
geminixiang deleted the refactor/mcp-to-llm-content branch October 9, 2026 14:36
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

0