Skip to main content
Glama

list_schems_proj

Lists available schemes in an Xcode project file to help developers manage build configurations. Provide the project path to retrieve scheme information.

Instructions

Lists available schemes in the project file. IMPORTANT: Requires projectPath. Example: list_schems_proj({ projectPath: '/path/to/MyProject.xcodeproj' })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesPath to the .xcodeproj file (Required)

Implementation Reference

  • Core handler logic shared between project and workspace scheme listing tools. Executes 'xcodebuild -list', parses the schemes section from output, lists them, and suggests next steps with other tools.
    async function _handleListSchemesLogic(params: {
      workspacePath?: string;
      projectPath?: string;
    }): Promise<ToolResponse> {
      log('info', 'Listing schemes');
    
      try {
        // For listing schemes, we can't use executeXcodeBuild directly since it's not a standard action
        // We need to create a custom command with -list flag
        const command = ['xcodebuild', '-list'];
    
        if (params.workspacePath) {
          command.push('-workspace', params.workspacePath);
        } else if (params.projectPath) {
          command.push('-project', params.projectPath);
        } // No else needed, one path is guaranteed by callers
    
        const result = await executeCommand(command, 'List Schemes');
    
        if (!result.success) {
          return createTextResponse(`Failed to list schemes: ${result.error}`, true);
        }
    
        // Extract schemes from the output
        const schemesMatch = result.output.match(/Schemes:([\s\S]*?)(?=\n\n|$)/);
    
        if (!schemesMatch) {
          return createTextResponse('No schemes found in the output', true);
        }
    
        const schemeLines = schemesMatch[1].trim().split('\n');
        const schemes = schemeLines.map((line) => line.trim()).filter((line) => line);
    
        // Prepare next steps with the first scheme if available
        let nextStepsText = '';
        if (schemes.length > 0) {
          const firstScheme = schemes[0];
          const projectOrWorkspace = params.workspacePath ? 'workspace' : 'project';
          const path = params.workspacePath || params.projectPath;
    
          nextStepsText = `Next Steps:
    1. Build the app: ${projectOrWorkspace === 'workspace' ? 'macos_build_workspace' : 'macos_build_project'}({ ${projectOrWorkspace}Path: "${path}", scheme: "${firstScheme}" })
       or for iOS: ${projectOrWorkspace === 'workspace' ? 'ios_simulator_build_by_name_workspace' : 'ios_simulator_build_by_name_project'}({ ${projectOrWorkspace}Path: "${path}", scheme: "${firstScheme}", simulatorName: "iPhone 16" })
    2. Show build settings: ${projectOrWorkspace === 'workspace' ? 'show_build_set_ws' : 'show_build_set_proj'}({ ${projectOrWorkspace}Path: "${path}", scheme: "${firstScheme}" })`;
        }
    
        return {
          content: [
            {
              type: 'text',
              text: `✅ Available schemes:`,
            },
            {
              type: 'text',
              text: schemes.join('\n'),
            },
            {
              type: 'text',
              text: nextStepsText,
            },
          ],
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        log('error', `Error listing schemes: ${errorMessage}`);
        return createTextResponse(`Error listing schemes: ${errorMessage}`, true);
      }
    }
  • Specific registration function for the 'list_schems_proj' tool, defining its name, description, input schema, and handler that validates projectPath and delegates to _handleListSchemesLogic.
    export function registerListSchemesProjectTool(server: McpServer): void {
      registerTool<BaseProjectParams>(
        server,
        'list_schems_proj',
        "Lists available schemes in the project file. IMPORTANT: Requires projectPath. Example: list_schems_proj({ projectPath: '/path/to/MyProject.xcodeproj' })",
        {
          projectPath: projectPathSchema,
        },
        async (params: BaseProjectParams) => {
          // Validate required parameters
          const projectValidation = validateRequiredParam('projectPath', params.projectPath);
          if (!projectValidation.isValid) return projectValidation.errorResponse!;
    
          return _handleListSchemesLogic(params);
        },
      );
    }
  • Zod schema definition for the required projectPath input parameter used by 'list_schems_proj' and other project-based tools.
    export const projectPathSchema = z.string().describe('Path to the .xcodeproj file (Required)');
  • Top-level registration entry that includes the registerListSchemesProjectTool in the toolRegistrations array, associating it with PROJECT_DISCOVERY group and an environment variable for conditional enabling.
    {
      register: registerListSchemesProjectTool,
      groups: [ToolGroup.PROJECT_DISCOVERY],
      envVar: 'XCODEBUILDMCP_TOOL_LIST_SCHEMES_PROJECT',
    },
  • Utility function registerTool used by all tools to register with the MCP server, wrapping the custom handler to match MCP SDK expectations.
    export function registerTool<T extends object>(
      server: McpServer,
      name: string,
      description: string,
      schema: Record<string, z.ZodType>,
      handler: (params: T) => Promise<ToolResponse>,
    ): void {
      // Create a wrapper handler that matches the signature expected by server.tool
      const wrappedHandler = (
        args: Record<string, unknown>,
        _extra: unknown,
      ): Promise<ToolResponse> => {
        // Assert the type *before* calling the original handler
        // This confines the type assertion to one place
        const typedParams = args as T;
        return handler(typedParams);
      };
    
      server.tool(name, description, schema, wrappedHandler);
    }
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. It mentions the requirement for 'projectPath' but doesn't disclose other behavioral traits such as whether this is a read-only operation, what the output format looks like (e.g., list of strings, JSON structure), error conditions, or performance considerations. The description is minimal and misses key details needed for safe and effective use.

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

Conciseness4/5

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

The description is appropriately sized with two sentences: one stating the purpose and requirement, and one providing an example. It's front-loaded with the core information and avoids unnecessary details, though the example could be slightly more concise by omitting the tool name repetition.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what 'schemes' are in this context (e.g., build configurations in Xcode), the return format, or potential errors. For a tool with no structured output documentation, more descriptive context is needed to guide the agent effectively.

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 schema description coverage is 100%, with the parameter 'projectPath' fully documented in the schema as 'Path to the .xcodeproj file (Required)'. The description adds minimal value by reiterating the requirement and providing an example, but doesn't offer additional semantics like format constraints or examples beyond the schema. This meets the baseline for high schema coverage.

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 verb ('Lists') and resource ('available schemes in the project file'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from its sibling 'list_schems_ws', which likely lists schemes in a workspace file, leaving some ambiguity about when to choose one over the other.

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

Usage Guidelines3/5

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

The description implies usage by specifying 'Requires projectPath' and providing an example, which gives context for when to use it. However, it lacks explicit guidance on when to use this tool versus alternatives like 'list_schems_ws' or other project-related tools, leaving the agent to infer based on the parameter name 'projectPath'.

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

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/SampsonKY/XcodeBuildMCP'

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