Skip to main content
Glama
conorluddy

XC-MCP: XCode CLI wrapper

by conorluddy

xcodebuild-showsdks

Retrieve available SDKs for iOS, macOS, watchOS, and tvOS development with structured JSON output, intelligent caching, and consistent error handling.

Instructions

Prefer this over 'xcodebuild -showsdks' - Gets available SDKs with intelligent caching and structured output.

Advantages over direct CLI: • Returns structured JSON data (vs parsing raw CLI text) • Smart caching prevents redundant SDK queries • Consistent error handling and validation • Clean, agent-friendly response format

Shows all available SDKs for iOS, macOS, watchOS, and tvOS development.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outputFormatNoOutput format preferencejson

Implementation Reference

  • Main execution handler for the xcodebuild-showsdks tool. Executes the xcodebuild -showsdks command (with optional -json), parses output, handles errors, and returns formatted text or JSON content.
    export async function xcodebuildShowSDKsTool(args: any) {
      const { outputFormat = 'json' } = args as ShowSDKsToolArgs;
    
      try {
        // Build command
        const command = outputFormat === 'json' ? 'xcodebuild -showsdks -json' : 'xcodebuild -showsdks';
    
        // Execute command
        const result = await executeCommand(command);
    
        if (result.code !== 0) {
          throw new McpError(ErrorCode.InternalError, `Failed to show SDKs: ${result.stderr}`);
        }
    
        let responseText: string;
    
        if (outputFormat === 'json') {
          try {
            // Parse and format JSON response
            const sdkInfo = JSON.parse(result.stdout);
            responseText = JSON.stringify(sdkInfo, null, 2);
          } catch (parseError) {
            throw new McpError(
              ErrorCode.InternalError,
              `Failed to parse xcodebuild -showsdks output: ${parseError}`
            );
          }
        } else {
          responseText = result.stdout;
        }
    
        return {
          content: [
            {
              type: 'text' as const,
              text: responseText,
            },
          ],
        };
      } catch (error) {
        if (error instanceof McpError) {
          throw error;
        }
        throw new McpError(
          ErrorCode.InternalError,
          `xcodebuild-showsdks failed: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • TypeScript interface defining the input schema for the tool arguments, including optional outputFormat.
    interface ShowSDKsToolArgs {
      outputFormat?: OutputFormat;
    }
  • Registration of the tool's documentation in the central TOOL_DOCS registry map, mapping the tool name to its documentation string.
    'xcodebuild-showsdks': XCODEBUILD_SHOWSDKS_DOCS,
  • Documentation string for the tool, used in rtfm and tool lists.
    export const XCODEBUILD_SHOWSDKS_DOCS = `
    # xcodebuild-showsdks
    
    ⚡ **Show available SDKs** for iOS, macOS, watchOS, and tvOS
    
    ## What it does
    
    Lists all SDKs available in your Xcode installation for building apps across Apple platforms. Returns structured JSON data instead of raw CLI text, making it easy to parse and validate SDK availability. Smart caching prevents redundant SDK queries, improving performance for repeated lookups. Validates Xcode installation before execution.
    
    ## Why you'd use it
    
    - Verify SDK availability before starting builds (prevent build failures)
    - Discover which platform versions are supported by your Xcode installation
    - Validate CI/CD environment has required SDKs installed
    - Get structured SDK data for automated build configuration
    
    ## Parameters
    
    ### Optional
    - **outputFormat** (string, default: 'json'): "json" or "text" output format
    
    ## Returns
    
    Structured JSON containing all available SDKs organized by platform (iOS, macOS, watchOS, tvOS). Each SDK entry includes platform name, version, and SDK identifier. Smart caching reduces query overhead for repeated lookups.
    
    ## Examples
    
    ### Get available SDKs as JSON
    \`\`\`typescript
    const sdks = await xcodebuildShowSDKsTool({ outputFormat: "json" });
    \`\`\`
    
    ### Get raw text output
    \`\`\`typescript
    const sdksText = await xcodebuildShowSDKsTool({ outputFormat: "text" });
    \`\`\`
    
    ## Related Tools
    
    - xcodebuild-version: Get Xcode version information
    - xcodebuild-build: Build with specific SDK
    `;
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: intelligent caching to prevent redundant queries, structured JSON output (vs raw CLI text), consistent error handling and validation, and a clean response format. It doesn't mention rate limits, authentication needs, or destructive effects, but for a read-only SDK listing tool, this coverage 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 well-structured and appropriately sized. It starts with a clear usage recommendation, lists advantages in bullet points for readability, and ends with the scope of SDKs covered. Every sentence adds value without redundancy, making it efficient and front-loaded with the most important information.

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 (read-only SDK listing with caching), no annotations, and no output schema, the description provides good contextual coverage. It explains the tool's behavior, advantages, and scope, though it doesn't detail the exact structure of the JSON output or caching mechanics. For a tool with 1 parameter and clear purpose, this is mostly complete but could slightly elaborate on output format examples.

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?

The input schema has 100% description coverage, with the single parameter 'outputFormat' fully documented in the schema (including enum values and default). The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline of 3 for high schema coverage without compensating value.

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 tool's purpose: 'Gets available SDKs' with specific resources (iOS, macOS, watchOS, tvOS SDKs). It distinguishes itself from the direct CLI command 'xcodebuild -showsdks' and from sibling tools like 'xcodebuild-list' or 'xcodebuild-version' by focusing specifically on SDK discovery with structured output.

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 explicitly states when to use this tool: '⚡ **Prefer this over 'xcodebuild -showsdks'' - Gets available SDKs with intelligent caching and structured output.' It provides clear alternatives (the direct CLI command) and lists specific advantages that justify choosing this tool instead, including structured JSON output, caching, error handling, and agent-friendly formatting.

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