Skip to main content
Glama

get_recent_tool_calls

Read-only

Retrieve recent tool call history to restore context, debug sequences, or onboard new chats with previous session data.

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

  • Main handler function that executes the get_recent_tool_calls tool. Parses arguments using the schema, retrieves formatted recent calls and stats from toolHistory, and returns formatted JSON response.
    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 get_recent_tool_calls: maxResults (1-1000, default 50), optional toolName filter, optional 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(),
    });
  • Registration in the main CallToolRequestSchema handler: dispatches calls to 'get_recent_tool_calls' to the handleGetRecentToolCalls function imported from handlers.
    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,
            };
        }
        break;
  • src/server.ts:989-1008 (registration)
    Tool registration in list_tools handler: defines the tool name, description, input schema, and annotations for the MCP protocol.
        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,
        },
    },
  • Core helper method in ToolHistory class that retrieves and formats recent tool calls with local timezone timestamps, used directly by the handler.
    getRecentCallsFormatted(options: {
      maxResults?: number;
      toolName?: string;
      since?: string;
    }): FormattedToolCallRecord[] {
      const calls = this.getRecentCalls(options);
      
      // Format timestamps to local timezone
      return calls.map(call => ({
        ...call,
        timestamp: formatLocalTimestamp(call.timestamp)
      }));
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations provide readOnlyHint=true, which the description aligns with by describing a retrieval operation. The description adds valuable behavioral context beyond annotations: it specifies that history is kept in memory (last 1000 calls, lost on restart), excludes tracking of its own calls and meta/query tools, and mentions the tool can be referenced as 'DC: ...' in instructions. This goes beyond the basic safety profile indicated by annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections: purpose statement, useful scenarios, behavioral notes, and usage reference. Each sentence adds value without redundancy. It's front-loaded with the core functionality and efficiently organized, making it easy to parse while remaining comprehensive.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema, read-only operation with annotations), the description provides strong contextual completeness. It covers purpose, usage guidelines, behavioral constraints, and memory limitations. The main gap is the lack of parameter details, but overall, it gives the agent sufficient context to understand when and how to invoke the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description carries the full burden of explaining parameters but provides no information about maxResults, toolName, or since. However, the description does imply filtering capabilities through phrases like 'recent tool call history' and 'chronological list', which loosely relate to the parameters. Since schema coverage is low, the description doesn't fully compensate, resulting in a baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific verb ('Get') and resource ('recent tool call history with their arguments and outputs'), distinguishing it from all sibling tools which focus on files, processes, searches, or configurations rather than tool call history. It explicitly defines the scope as 'during this session' and 'chronological list', making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage scenarios in the 'Useful for' section (onboarding, recovering context, debugging) and clear exclusions in the 'Note' (does not track its own calls or meta/query tools). It also mentions memory limitations (last 1000 calls, lost on restart), giving comprehensive guidance on when and how to use this tool effectively.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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