Skip to main content
Glama

pages_create_document

Generate a new Pages document with plain text content using AppleScript on macOS. Ideal for creating unformatted documents programmatically within LLM applications.

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

  • Handler function that generates the AppleScript executed when the pages_create_document tool is called. It creates a new Pages document and sets 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 `
  • JSON Schema for input validation of the pages_create_document tool, requiring a 'content' parameter of type string.
    schema: { type: "object", properties: { content: { type: "string", description: "The plain text content to add to the document (no formatting)" } }, required: ["content"]
  • Registration of the create_document script within the pages category. The full tool name 'pages_create_document' is formed by combining category.name + '_' + script.name during MCP tool listing.
    { name: "create_document", description: "Create a new Pages document with plain text content (no formatting)", schema: { type: "object", properties: { content: { type: "string", description: "The plain text content to add to the document (no formatting)" } }, required: ["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 ` }
  • src/index.ts:32-32 (registration)
    Registers the entire pages category (including create_document script) with the AppleScriptFramework server, making pages_create_document available as an MCP tool.
    server.addCategory(pagesCategory);

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