Skip to main content
Glama

textedit_create_document

Create new TextEdit documents on macOS with optional initial content. Use this tool to generate text files quickly for notes, drafts, or any text-based work.

Instructions

Create new TextEdit document with optional content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNoOptional initial content for the document

Implementation Reference

  • The handler case for 'textedit_create_document' that executes an AppleScript via osascript to create a new TextEdit document, optionally pre-filling it with provided content, and returns the document name or error.
    case 'textedit_create_document': try { const content = (args?.content as string) || ''; const command = `osascript -e 'on run argv set docContent to item 1 of argv tell application "TextEdit" set newDoc to make new document if docContent is not "" then set text of newDoc to docContent end if set docName to name of newDoc return "Created document: " & docName end tell end run' -- "${content}"`; const { stdout, stderr } = await execAsync(command); if (stderr.trim()) { return { content: [ { type: 'text', text: `Error creating TextEdit document: ${stderr.trim()}`, }, ], }; } const output = stdout.trim(); if (!output || output === '') { return { content: [ { type: 'text', text: 'Document created but name could not be retrieved', }, ], }; } return { content: [ { type: 'text', text: output, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error executing TextEdit create document command: ${error.message}`, }, ], }; }
  • The tool definition in the ListTools response, including name, description, and input schema for validation.
    { name: 'textedit_create_document', description: 'Create new TextEdit document with optional content', inputSchema: { type: 'object', properties: { content: { type: 'string', description: 'Optional initial content for the document', }, }, }, },

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/samicokar/mcp-mac'

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