Skip to main content
Glama
wonderwhy-er

Claude Desktop Commander MCP

get_usage_stats

Retrieve usage statistics, including success rates and performance metrics, for debugging and analysis in the Claude Desktop Commander MCP server.

Instructions

                    Get usage statistics for debugging and analysis.
                    
                    Returns summary of tool usage, success/failure rates, and performance metrics.
                    
                    This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler function getUsageStats that calls usageTracker.getUsageSummary() and formats the response as MCP ServerResult.
    export async function getUsageStats(): Promise<ServerResult> {
      try {
        const summary = await usageTracker.getUsageSummary();
        
        return {
          content: [{
            type: "text",
            text: summary
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `Error retrieving usage stats: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    }
  • Zod schema defining empty input arguments for the tool.
    export const GetUsageStatsArgsSchema = z.object({});
  • src/server.ts:934-946 (registration)
    Tool registration in listTools handler: defines name, description, inputSchema from GetUsageStatsArgsSchema.
        name: "get_usage_stats",
        description: `
                Get usage statistics for debugging and analysis.
                
                Returns summary of tool usage, success/failure rates, and performance metrics.
                
                ${CMD_PREFIX_DESCRIPTION}`,
        inputSchema: zodToJsonSchema(GetUsageStatsArgsSchema),
        annotations: {
            title: "Get Usage Statistics",
            readOnlyHint: true,
        },
    },
  • Dispatch handler in callToolRequest: invokes getUsageStats() and handles errors.
    case "get_usage_stats":
        try {
            result = await getUsageStats();
        } catch (error) {
            capture('server_request_error', { message: `Error in get_usage_stats handler: ${error}` });
            result = {
                content: [{ type: "text", text: `Error: Failed to get usage statistics` }],
                isError: true,
            };
        }
  • Helper method getUsageSummary in UsageTracker class that computes and formats the usage statistics summary string.
      async getUsageSummary(): Promise<string> {
        const stats = await this.getStats();
        const now = Date.now();
    
        const daysSinceFirst = Math.round((now - stats.firstUsed) / (1000 * 60 * 60 * 24));
        const uniqueTools = Object.keys(stats.toolCounts).length;
        const successRate = stats.totalToolCalls > 0 ?
          Math.round((stats.successfulCalls / stats.totalToolCalls) * 100) : 0;
    
        const topTools = Object.entries(stats.toolCounts)
          .sort(([,a], [,b]) => b - a)
          .slice(0, 5)
          .map(([tool, count]) => `${tool}: ${count}`)
          .join(', ');
    
        return `📊 **Usage Summary**
    • Total calls: ${stats.totalToolCalls} (${stats.successfulCalls} successful, ${stats.failedCalls} failed)
    • Success rate: ${successRate}%
    • Days using: ${daysSinceFirst}
    • Sessions: ${stats.totalSessions}
    • Unique tools: ${uniqueTools}
    • Most used: ${topTools || 'None'}
    • Feedback given: ${(await configManager.getValue('feedbackGiven')) ? 'Yes' : 'No'}
    
    **By Category:**
    • Filesystem: ${stats.filesystemOperations}
    • Terminal: ${stats.terminalOperations}
    • Editing: ${stats.editOperations}
    • Search: ${stats.searchOperations}
    • Config: ${stats.configOperations}
    • Process: ${stats.processOperations}`;
      }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool returns summary data (usage, success/failure rates, performance metrics), which is helpful, but doesn't cover important aspects like whether this requires special permissions, has rate limits, affects system state, or what format the return data takes. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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

Conciseness3/5

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

The description is three sentences with some wasted space (extra line breaks and quotation marks in the provided text). The first two sentences are useful, but the third sentence about referencing commands adds little value for an AI agent selecting tools. It's moderately concise but could be more focused.

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

Completeness3/5

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

Given the tool has 0 parameters, no output schema, and no annotations, the description provides basic information about what the tool does and returns. However, it lacks details about the return format, error conditions, or prerequisites that would be helpful for a debugging/analysis tool. It's minimally adequate but has clear gaps in completeness.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, which is correct for a parameterless tool. It adds value by explaining what the tool returns rather than focusing on inputs.

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

Purpose3/5

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

The description states the tool 'Get usage statistics for debugging and analysis', which provides a clear verb ('Get') and resource ('usage statistics') with a purpose ('debugging and analysis'). However, it doesn't differentiate from sibling tools like 'get_config' or 'get_file_info' that also retrieve information, making the purpose somewhat generic rather than specific.

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

Usage Guidelines2/5

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

The description includes no guidance on when to use this tool versus alternatives. It mentions the tool can be referenced in instructions, but this doesn't help an AI agent decide when this tool is appropriate compared to other get_* tools on the server. There's no explicit when/when-not or alternative tool recommendations.

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

Related 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/DesktopCommanderMCP'

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