Skip to main content
Glama
conorluddy

XC-MCP: XCode CLI wrapper

by conorluddy

list-cached-responses

Retrieve recent cached build/test results from XC-MCP to manage large Xcode CLI outputs efficiently. Filter by tool and set response limits for progressive disclosure.

Instructions

List recent cached build/test results for progressive disclosure

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of cached responses to return
toolNoFilter by specific tool (optional)

Implementation Reference

  • The core handler function for the 'list-cached-responses' tool. It processes arguments, retrieves cache stats and recent responses from responseCache, formats a JSON response with summaries, and returns MCP-formatted content.
    export async function listCachedResponsesTool(args: any) {
      const { tool, limit = 10 } = args as ListCachedArgs;
    
      try {
        const stats = responseCache.getStats();
    
        let recentResponses;
        if (tool) {
          recentResponses = responseCache.getRecentByTool(tool, limit);
        } else {
          // Get recent from all tools
          const allTools = Object.keys(stats.byTool);
          recentResponses = allTools
            .flatMap(toolName =>
              responseCache.getRecentByTool(toolName, Math.ceil(limit / allTools.length))
            )
            .sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime())
            .slice(0, limit);
        }
    
        const responseData = {
          cacheStats: stats,
          recentResponses: recentResponses.map(cached => ({
            id: cached.id,
            tool: cached.tool,
            timestamp: cached.timestamp,
            exitCode: cached.exitCode,
            outputSize: cached.fullOutput.length,
            stderrSize: cached.stderr.length,
            summary: cached.metadata.summary || {},
            projectPath: cached.metadata.projectPath,
            scheme: cached.metadata.scheme,
          })),
          usage: {
            totalCached: stats.totalEntries,
            availableTools: Object.keys(stats.byTool),
            note: 'Use xcodebuild-get-details with any ID to retrieve full details',
          },
        };
    
        const responseText = JSON.stringify(responseData, null, 2);
    
        return {
          content: [
            {
              type: 'text' as const,
              text: responseText,
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `list-cached-responses failed: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Type definition for the tool's input parameters: optional tool filter and limit.
    interface ListCachedArgs {
      tool?: string;
      limit?: number;
    }
  • Detailed markdown documentation for the tool, including parameters, returns, examples, and related tools. Serves as de facto schema description.
    export const CACHE_LIST_CACHED_RESPONSES_DOCS = `
    # list-cached-responses
    
    šŸ“‹ **List cached build and test results with progressive disclosure** - View recent operations.
    
    Retrieve recent cached build/test results with ability to drill down into full logs via progressive disclosure pattern.
    
    ## Advantages
    
    • Access recent build and test results without re-running operations
    • Drill down into full logs using returned cache IDs
    • Filter by specific tool to find relevant operations
    • Understand cache age and expiry information
    
    ## Parameters
    
    ### Optional
    - \`limit\` (number, default: 10): Maximum number of cached responses to return
    - \`tool\` (string): Filter by specific tool (optional)
    
    ## Returns
    
    - List of recent cache entries with IDs
    - Summary information for each cached operation
    - Cache expiry times
    - References for accessing full details
    
    ## Related Tools
    
    - \`xcodebuild-get-details\` - Retrieve full build logs from cache ID
    - \`xcodebuild-test\` - Run tests (generates new cache entries)
    - \`cache-get-stats\` - View cache performance statistics
    - \`cache-clear\` - Clear specific caches
    
    ## Notes
    
    - Returns summaries only to avoid token waste
    - Use returned cache IDs with xcodebuild-get-details for full output
    - Ordered by recency (most recent first)
    - Limited to reduce response token usage
    `;
  • Registration of the tool's documentation in the central TOOL_DOCS map used by the rtfm/get-tool-docs tool.
    'list-cached-responses': CACHE_LIST_CACHED_RESPONSES_DOCS,
  • Reference to the tool in the consolidated cache tool documentation.
    - \`list-cached-responses\`: View cached response IDs
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 mentions 'recent cached' results, implying temporal filtering and caching behavior, but doesn't specify what 'recent' means (e.g., time window, recency criteria), how results are ordered, or any limitations like rate limits or permissions. The description adds minimal context beyond the basic action.

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 a single, efficient sentence that front-loads the core purpose ('List recent cached build/test results') and adds a concise qualifier ('for progressive disclosure'). There is no wasted language, and every word contributes to understanding the tool's intent.

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

Completeness2/5

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

Given the complexity (a list operation with filtering), no annotations, and no output schema, the description is incomplete. It lacks details on behavioral aspects (e.g., what 'recent' entails, ordering, pagination), usage context, and output format. For a tool with 2 parameters and no structured support, more comprehensive guidance is needed.

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?

Schema description coverage is 100%, so the schema fully documents both parameters (limit and tool). The description doesn't add any parameter-specific semantics beyond what's in the schema, such as explaining 'progressive disclosure' in relation to filtering. With high schema coverage, the baseline is 3, and the description doesn't compensate with extra insights.

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

Purpose4/5

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

The description clearly states the action ('List') and resource ('recent cached build/test results') with a specific purpose ('for progressive disclosure'). It distinguishes from siblings like cache-clear or cache-get-stats by focusing on listing results rather than management or statistics. However, it doesn't explicitly differentiate from cache-get-config or other list tools in the sibling set.

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 provides no guidance on when to use this tool versus alternatives like cache-get-stats or xcodebuild-list. It mentions 'progressive disclosure' as a context, but this is vague and doesn't specify scenarios, prerequisites, or exclusions. No explicit alternatives or when-not-to-use information is provided.

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