Skip to content

Display tool execution results in terminal#108

Merged
spachava753 merged 1 commit intomainfrom
feat/print-tool-execution-results
Dec 6, 2025
Merged

Display tool execution results in terminal#108
spachava753 merged 1 commit intomainfrom
feat/print-tool-execution-results

Conversation

@spachava753
Copy link
Copy Markdown
Owner

@spachava753 spachava753 commented Dec 6, 2025

Summary

Adds visibility into tool execution by displaying results to stderr during agent runs. Users can now see what data tools return, making it easier to verify tool behavior and debug issues when the agent acts on incorrect information.

Changes

Tool results are now printed to stderr with glamour markdown rendering:

  • JSON responses are automatically pretty-printed in json code blocks
  • Code execution output appears in shell code blocks
  • Results are truncated to 20 lines to keep output manageable
  • Styling is consistent with the response printer

Implementation

  • Added tool callback wrapper that intercepts tool results and prints them
  • Integrated wrapper into the generator middleware chain
  • Created shared content renderer helper for consistent styling
  • Added table-driven tests for various tool result scenarios

Example Output

Regular MCP Tool:

#### Tool "get_weather" result:
```json
{
  "condition": "sunny",
  "temperature": 72
}
```

Code Execution:

#### Code execution output:
```shell
Reading file data.txt...
Found 5 matches.
```

Closes #105

Adds visibility into tool execution by displaying results to stderr during agent runs. Users can now see what data tools return, making it easier to verify tool behavior and debug issues when the agent acts on incorrect information.

Tool results are rendered as styled markdown with syntax highlighting, truncated to 20 lines to keep output manageable. JSON responses are automatically pretty-printed in json code blocks, while code execution output appears in shell code blocks.

Closes #105
@spachava753 spachava753 merged commit 980f415 into main Dec 6, 2025
@spachava753 spachava753 deleted the feat/print-tool-execution-results branch April 10, 2026 00:23
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.

[Enhancement]: Print tool execution results to terminal

1 participant