Skip to main content
Glama
conorluddy

XC-MCP: XCode CLI wrapper

by conorluddy

cache-get-stats

Retrieve detailed statistics on cache systems, including hit rates, expiry times, storage usage, and performance metrics. Ideal for monitoring effectiveness, debugging issues, understanding patterns, and optimizing cache layers.

Instructions

Get comprehensive statistics about all cache systems (simulator, project, response).

Shows cache hit rates, expiry times, storage usage, and performance metrics across all caching layers.

Useful for:

  • Monitoring cache effectiveness

  • Debugging performance issues

  • Understanding usage patterns

  • Cache optimization decisions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that aggregates and returns statistics from all caching systems (simulator, project, response) as formatted JSON.
    export async function getCacheStatsTool(_args: any): Promise<ToolResult> {
      try {
        const simulatorStats = simulatorCache.getCacheStats();
        const projectStats = projectCache.getCacheStats();
        const responseStats = responseCache.getStats();
    
        const stats = {
          simulator: simulatorStats,
          project: projectStats,
          response: responseStats,
          timestamp: new Date().toISOString(),
        };
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify(stats, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get cache stats: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Registers the 'cache' MCP tool which routes 'get-stats' operation to the cache-get-stats implementation. Provides backwards compatibility for the legacy tool name.
    server.registerTool(
      'cache',
      {
        description: getDescription(CACHE_DOCS, CACHE_DOCS_MINI),
        inputSchema: {
          operation: z.enum(['get-stats', 'get-config', 'set-config', 'clear']),
          cacheType: z.enum(['simulator', 'project', 'response', 'all']).optional(),
          maxAgeMs: z.number().optional(),
          maxAgeMinutes: z.number().optional(),
          maxAgeHours: z.number().optional(),
        },
        ...DEFER_LOADING_CONFIG,
      },
      async args => {
        try {
          await validateXcodeInstallation();
          // eslint-disable-next-line @typescript-eslint/no-explicit-any
          return (await cacheTool(args)) as any;
        } catch (error) {
          if (error instanceof McpError) throw error;
          throw new McpError(
            ErrorCode.InternalError,
            `Tool execution failed: ${error instanceof Error ? error.message : String(error)}`
          );
        }
      }
    );
  • Zod schema defining input parameters for cache operations, including 'get-stats' which requires no additional arguments.
    inputSchema: {
      operation: z.enum(['get-stats', 'get-config', 'set-config', 'clear']),
      cacheType: z.enum(['simulator', 'project', 'response', 'all']).optional(),
      maxAgeMs: z.number().optional(),
      maxAgeMinutes: z.number().optional(),
      maxAgeHours: z.number().optional(),
    },
    ...DEFER_LOADING_CONFIG,
  • Operation router in consolidated cacheTool that invokes the specific getCacheStatsTool handler for 'get-stats'.
    case 'get-stats':
      return getCacheStatsTool({});
    case 'get-config':
  • Embedded documentation for the cache-get-stats tool, including usage examples and parameter details.
    export const CACHE_GET_STATS_DOCS = `
    # cache-get-stats
    
    šŸ“Š **Get comprehensive statistics across all XC-MCP cache systems** - Monitor cache performance and effectiveness.
    
    Retrieves detailed statistics from the simulator cache, project cache, and response cache systems. Shows hit rates, entry counts, storage usage, and performance metrics across all caching layers. Essential for monitoring cache effectiveness and identifying optimization opportunities.
    
    ## Advantages
    
    • Monitor cache performance across all simulator, project, and response caches
    • Understand cache hit rates to optimize build and test workflows
    • Track memory usage and identify tuning opportunities
    • Debug performance issues by analyzing cache patterns
    
    ## Parameters
    
    ### Required
    - (None - retrieves statistics from all cache systems automatically)
    
    ### Optional
    - (None)
    
    ## Returns
    
    - Tool execution results with structured cache statistics
    - Statistics for each cache system (simulator, project, response)
    - Hit rates, entry counts, and performance metrics
    - Timestamp of statistics collection
    
    ## Related Tools
    
    - cache-set-config: Configure cache retention times
    - cache-get-config: Get current cache configuration
    - cache-clear: Clear cached data
    
    ## Notes
    
    - Tool is auto-registered with MCP server
    - Statistics are calculated in real-time
    - Use regularly to monitor cache effectiveness
    - Export statistics for performance analysis across time
    `;
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing behavioral traits: it's a read-only operation ('Get...statistics'), covers multiple caching layers, and specifies the types of metrics returned (hit rates, expiry times, storage usage, performance metrics). It doesn't mention rate limits or authentication needs, but for a stats tool with zero parameters, this is reasonably comprehensive.

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 efficiently structured: a clear purpose statement, a detailed second sentence expanding on metrics, and a bulleted list of use cases. Every sentence earns its place without redundancy, and the information is front-loaded with the core functionality.

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 complexity (statistical reporting with no parameters) and lack of output schema, the description is nearly complete: it explains what the tool does, when to use it, and what metrics to expect. It could slightly improve by hinting at the return format (e.g., structured data vs. text), but for a read-only stats tool, this is sufficient.

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 tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description appropriately doesn't discuss parameters, focusing instead on what statistics are returned, which adds value beyond the empty schema.

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 action ('Get comprehensive statistics') and resource ('all cache systems') with explicit scope ('simulator, project, response'). It distinguishes from siblings like cache-clear (destructive) and cache-get-config (configuration-focused) by emphasizing statistical monitoring rather than configuration or modification.

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 a bulleted list ('Useful for: - Monitoring cache effectiveness - Debugging performance issues - Understanding usage patterns - Cache optimization decisions'), giving clear context for when to invoke this tool versus alternatives like cache-get-config for configuration or list-cached-responses for specific cached items.

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/conorluddy/xc-mcp'

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