Skip to content

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Oct 15, 2025

Improve the formatting of tool calls.

Single tool call

Before After
image image

Multiple tool calls

Before After
image image

@jtpio jtpio added the enhancement New feature or request label Oct 15, 2025
@jtpio jtpio added this to the 0.9.0 milestone Oct 15, 2025
@jtpio jtpio marked this pull request as ready for review October 15, 2025 13:18
@jtpio jtpio requested a review from brichet October 15, 2025 13:18
Copy link
Collaborator

@brichet brichet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jtpio, it works well on my side.
I just have a comment, mostly about consistency.

* @param input The tool input to format (object or string)
* @returns Pretty-printed JSON string
*/
private _formatToolInput(input: string | object): string {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, I wonder if it should be formatted in the agent instead of the chat model, as it is for the tool_call_complete output, or the tool_call_start input.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, let's try to clean that up in this PR too 👍

Copy link
Collaborator

@brichet brichet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jtpio, if this is ready, it looks good to me.

}
}
// If it's an object, stringify it with formatting
return JSON.stringify(input, null, 2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that it is serializable, or should we try/except it ?

We use this function to format, for example, RunToolApprovalItem.rawItem, which contains at least one any type, according to the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants