feat(mcp): add file output for large conversions#2202
Open
dexhunter wants to merge 1 commit into
Open
Conversation
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
Add an opt-in
output_filemode to the MarkItDown MCP tool for conversions that exceed an MCP client's response limit.The default
convert_to_markdown(uri)behavior is unchanged. Whenoutput_fileis set, the tool writes the complete markdown to a new permission-restricted file and returns its absolute path instead of returning the full document through MCP.Motivation
Issue #1332 reports a 51,164-token conversion exceeding a 25,000-token MCP response limit and requests an option to write the result to a file. Returning a short local path avoids the response-size failure while preserving the full converted document. Automatic pagination from #1333 remains separate work.
Safety
0600on POSIX systems (platform-default permissions on Windows), and existing files are never overwritten.Evidence
A strict synthetic large-document evaluation measured the MCP tool result:
Supplementary autoresearch: public dashboard.
Validation
Fixes #1332