standardize tool call logging

This commit is contained in:
Colin McDonnell
2025-11-21 14:51:13 -08:00
parent b6bfcb0cca
commit 6ba92cb9d8
4 changed files with 34 additions and 59 deletions
+15 -25
View File
@@ -308,10 +308,24 @@ export const log = {
*/
endGroup,
/**
* Log tool call information to console with formatted output
*/
toolCall: ({ toolName, input }: { toolName: string; input: unknown }): void => {
let output = `${toolName}\n`;
const inputFormatted = formatJsonValue(input);
if (inputFormatted !== "{}") {
output += formatIndentedField("input", inputFormatted);
}
log.info(output.trimEnd());
},
/**
* Log MCP tool call information to mcpLog.txt in the temp directory
*/
toolCall: ({
toolCallToFile: ({
toolName,
request,
result,
@@ -420,30 +434,6 @@ function formatToolCall({
return logEntry;
}
/**
* Format a tool call log entry with tool name and input
*/
export function formatToolCallLog({
toolName,
input,
result: _result,
}: {
toolName: string;
input: unknown;
result?: unknown;
}): string {
let output = `${toolName}\n`;
const inputFormatted = formatJsonValue(input);
if (inputFormatted !== "{}") {
output += formatIndentedField("input", inputFormatted);
}
// result parameter added for future use but not implemented yet
return output.trimEnd();
}
/**
* Finds a CLI executable path by checking if it's installed globally
* @param name The name of the CLI executable to find