Skip to main content
Glama

swift_package_list

Identify active Swift Package processes on XcodeBuildMCP to monitor and manage current tasks efficiently.

Instructions

Lists currently running Swift Package processes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that implements the logic to list active Swift Package processes, calculating runtime and formatting the output.
    export async function swift_package_listLogic( params?: unknown, dependencies?: ProcessListDependencies, ): Promise<ToolResponse> { const processMap = dependencies?.processMap ?? activeProcesses; const arrayFrom = dependencies?.arrayFrom ?? Array.from; const dateNow = dependencies?.dateNow ?? Date.now; const processes = arrayFrom(processMap.entries()); if (processes.length === 0) { return { content: [ createTextContent('ℹ️ No Swift Package processes currently running.'), createTextContent('💡 Use swift_package_run to start an executable.'), ], }; } const content = [createTextContent(`📋 Active Swift Package processes (${processes.length}):`)]; for (const [pid, info] of processes) { // Use logical OR instead of nullish coalescing to treat empty strings as falsy // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing const executableName = info.executableName || 'default'; const runtime = Math.max(1, Math.round((dateNow() - info.startedAt.getTime()) / 1000)); content.push( createTextContent( ` • PID ${pid}: ${executableName} (${info.packagePath}) - running ${runtime}s`, ), ); } content.push(createTextContent('💡 Use swift_package_stop with a PID to terminate a process.')); return { content }; }
  • Zod schema definition for tool parameters (empty since no input parameters are required) and inferred TypeScript type.
    const swiftPackageListSchema = z.object({}); // Use z.infer for type safety type SwiftPackageListParams = z.infer<typeof swiftPackageListSchema>;
  • Tool registration as default export, including name, description, schema, and a typed handler wrapper around the core logic.
    export default { name: 'swift_package_list', description: 'Lists currently running Swift Package processes', schema: swiftPackageListSchema.shape, // MCP SDK compatibility handler: createTypedTool( swiftPackageListSchema, (params: SwiftPackageListParams) => { return swift_package_listLogic(params); }, getDefaultCommandExecutor, ), };

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

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