Skip to main content
Glama

get_recent_tool_calls

Retrieve recent tool call history with arguments and outputs to maintain session context, onboard new chats, or debug command sequences.

Instructions

Get recent tool call history with their arguments and outputs. Returns chronological list of tool calls made during this session. Useful for: - Onboarding new chats about work already done - Recovering context after chat history loss - Debugging tool call sequences Note: Does not track its own calls or other meta/query tools. History kept in memory (last 1000 calls, lost on restart). This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxResultsNo
toolNameNo
sinceNo

Implementation Reference

  • The main handler function that parses arguments using the schema, retrieves recent tool calls from toolHistory utility, formats them as JSON, and returns a ServerResult with the history summary.
    export async function handleGetRecentToolCalls(args: unknown): Promise<ServerResult> { try { const parsed = GetRecentToolCallsArgsSchema.parse(args); // Use formatted version with local timezone const calls = toolHistory.getRecentCallsFormatted({ maxResults: parsed.maxResults, toolName: parsed.toolName, since: parsed.since }); const stats = toolHistory.getStats(); // Format the response (excluding file path per user request) const summary = `Tool Call History (${calls.length} results, ${stats.totalEntries} total in memory)`; const historyJson = JSON.stringify(calls, null, 2); return { content: [{ type: "text", text: `${summary}\n\n${historyJson}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error getting tool history: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
  • Zod schema defining input parameters for the get_recent_tool_calls tool: optional maxResults (1-1000, default 50), toolName filter, and since datetime filter.
    export const GetRecentToolCallsArgsSchema = z.object({ maxResults: z.number().min(1).max(1000).optional().default(50), toolName: z.string().optional(), since: z.string().datetime().optional(), });
  • src/server.ts:948-967 (registration)
    Tool registration in the list_tools handler: defines name, description, input schema from GetRecentToolCallsArgsSchema, and annotations.
    name: "get_recent_tool_calls", description: ` Get recent tool call history with their arguments and outputs. Returns chronological list of tool calls made during this session. Useful for: - Onboarding new chats about work already done - Recovering context after chat history loss - Debugging tool call sequences Note: Does not track its own calls or other meta/query tools. History kept in memory (last 1000 calls, lost on restart). ${CMD_PREFIX_DESCRIPTION}`, inputSchema: zodToJsonSchema(GetRecentToolCallsArgsSchema), annotations: { title: "Get Recent Tool Calls", readOnlyHint: true, }, },
  • Dispatch in the call_tool request handler: routes get_recent_tool_calls calls to the handleGetRecentToolCalls function with error handling.
    case "get_recent_tool_calls": try { result = await handlers.handleGetRecentToolCalls(args); } catch (error) { capture('server_request_error', { message: `Error in get_recent_tool_calls handler: ${error}` }); result = { content: [{ type: "text", text: `Error: Failed to get tool call history` }], isError: true, }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wonderwhy-er/ClaudeComputerCommander'

If you have feedback or need assistance with the MCP directory API, please join our Discord server