Skip to content

fix: flush large piped tool output#246

Open
haosenwang1018 wants to merge 1 commit intophilschmid:mainfrom
haosenwang1018:fix/pipe-large-tool-output
Open

fix: flush large piped tool output#246
haosenwang1018 wants to merge 1 commit intophilschmid:mainfrom
haosenwang1018:fix/pipe-large-tool-output

Conversation

@haosenwang1018
Copy link
Copy Markdown

Summary

  • replace console.log() in call output with an explicit stdout writer
  • wait for drain when stdout backpressure is applied
  • preserve the existing CLI-friendly text output format

Problem

Issue #23 reports that large tool results are truncated at 65536 bytes when mcp-cli call ... is piped to another process. This points to the output path not respecting pipe backpressure.

Fix

The call command now writes formatted tool output through process.stdout.write() and awaits the drain event when needed, instead of relying on console.log(). That keeps the same output shape while ensuring large responses are fully flushed through piped stdout.

Fixes #23

Validation

  • git diff --check
  • npx tsc --noEmit
  • bun test tests/config.test.ts
  • bun test tests/output.test.ts
  • npx @biomejs/biome check src/commands/call.ts

Signed-off-by: haosenwang1018 <haosenwang1018@users.noreply.github.com>
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.

Output is truncated at 65536 bytes when piped to another process

1 participant