Skip to main content
Glama

create_folder

Create new folders in Apple Notes to organize your notes and documents. Use this tool to structure your note collection by adding named folders for better content management.

Instructions

Create a new folder in Apple Notes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the folder to create

Implementation Reference

  • Handler for the 'create_folder' tool. Parses the folder name argument, runs AppleScript via runAppleScript helper to create a new folder in Apple Notes, and returns success message.
    case 'create_folder': {
      const { name: folderName } = z.object({ name: z.string() }).parse(args);
      const script = `
        tell application "Notes"
          make new folder with properties {name:"${folderName}"}
          return "Folder '${folderName}' created successfully"
        end tell
      `;
      
      const result = await runAppleScript(script);
      return {
        content: [
          {
            type: 'text',
            text: result,
          },
        ],
      };
    }
  • Tool registration in listTools handler, defining name, description, and input schema for 'create_folder' requiring 'name' string.
    {
      name: 'create_folder',
      description: 'Create a new folder in Apple Notes',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Name of the folder to create'
          }
        },
        required: ['name']
      },
    }
  • Inline Zod schema validation for create_folder input arguments.
    const { name: folderName } = z.object({ name: z.string() }).parse(args);
  • Shared helper function runAppleScript used by create_folder (and other tools) to execute AppleScript safely via temporary files and osascript.
    async function runAppleScript(script: string): Promise<string> {
      try {
        // Write script to temporary file to avoid shell escaping issues
        const tempFile = join(tmpdir(), `applescript-${Date.now()}.scpt`);
        writeFileSync(tempFile, script, 'utf8');
        
        try {
          const { stdout } = await execAsync(`osascript "${tempFile}"`);
          return stdout.trim();
        } finally {
          unlinkSync(tempFile);
        }
      } catch (error: any) {
        throw new McpError(ErrorCode.InternalError, `AppleScript error: ${error.message}`);
      }
    }

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/tdisawas0github/mcp'

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