Skip to main content
Glama

pages_create_document

Create a new Pages document with plain text content using AppleScript automation for macOS.

Instructions

[Pages document operations] Create a new Pages document with plain text content (no formatting)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesThe plain text content to add to the document (no formatting)

Implementation Reference

  • The handler function that generates AppleScript code to create a new Pages document and set its body text to the provided plain text content.
    script: (args) => `
      try
        tell application "Pages"
          -- Create new document
          set newDoc to make new document
          
          set the body text of newDoc to "${args.content.replace(/"/g, '\\"')}"
          activate
          return "Document created successfully with plain text content"
        end tell
      on error errMsg
        return "Failed to create document: " & errMsg
      end try
    `
  • Input schema requiring a 'content' string parameter for the document text.
    schema: {
      type: "object",
      properties: {
        content: {
          type: "string",
          description: "The plain text content to add to the document (no formatting)"
        }
      },
      required: ["content"]
  • src/index.ts:32-32 (registration)
    Registers the pages category, which includes the create_document tool, with the MCP server.
    server.addCategory(pagesCategory);
  • src/index.ts:9-9 (registration)
    Imports the pages category definition containing the create_document tool.
    import { pagesCategory } from "./categories/pages.js";
  • Constructs the MCP tool name in the format 'category_script', resulting in 'pages_create_document' for this tool.
    name: `${category.name}_${script.name}`, // Changed from dot to underscore

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/joshrutkowski/applescript-mcp'

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