Skip to main content
Glama
recursechat

Apple Shortcuts Server

by recursechat

run_shortcut

Execute Apple Shortcuts automations by name to automate tasks on Apple devices, with optional input parameters for customization.

Instructions

Run a Shortcuts automation by name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the shortcut to run
inputNoOptional input to pass to the shortcut

Implementation Reference

  • The handler case for 'run_shortcut' tool, which constructs and executes a 'shortcuts run' command using execSync, handling input and errors.
    case "run_shortcut": {
      try {
        const command = args.input
          ? `shortcuts run "${args.name}" -i "${args.input}"`
          : `shortcuts run "${args.name}"`;
    
        console.error("MCP shortcuts: Running command:", command);
        const stdout = execSync(command).toString();
    
        return {
          content: [
            {
              type: "text",
              text: stdout || "Shortcut executed successfully",
            },
          ],
          isError: false,
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Failed to run shortcut: ${(error as Error).message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Tool definition including name, description, and input schema for 'run_shortcut' in the TOOLS array.
    name: "run_shortcut",
    description: "Run a Shortcuts automation by name",
    inputSchema: {
      type: "object",
      properties: {
        name: { type: "string", description: "Name of the shortcut to run" },
        input: {
          type: "string",
          description: "Optional input to pass to the shortcut",
        },
      },
      required: ["name"],
    },
  • src/index.ts:164-166 (registration)
    Registration of the tools list, which includes the 'run_shortcut' tool via the TOOLS array.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: TOOLS,
    }));
  • src/index.ts:168-170 (registration)
    Registration of the CallToolRequestSchema handler, which dispatches to the 'handleToolCall' function containing the 'run_shortcut' logic.
    server.setRequestHandler(CallToolRequestSchema, async (request) =>
      handleToolCall(request.params.name, request.params.arguments ?? {})
    );
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/recursechat/mcp-server-apple-shortcuts'

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