Skip to main content
Glama

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}`; }

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