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',
          },
        },
      },
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a document but doesn't cover critical aspects like whether it requires specific permissions, what happens to the document after creation (e.g., saved location), or error conditions. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('Create new TextEdit document') and includes the key detail ('with optional content'). There is no wasted verbiage, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's mutation nature, lack of annotations, and no output schema, the description is insufficient. It doesn't explain what the tool returns (e.g., document ID, success status), potential side effects, or usage constraints. For a creation tool with these gaps, more contextual information is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'optional content', which aligns with the single parameter 'content' in the schema. Since schema description coverage is 100%, the baseline is 3. The description adds minimal value beyond the schema's documentation of the parameter as optional initial content.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Create') and resource ('new TextEdit document'), making the purpose immediately understandable. It distinguishes from sibling tools like 'textedit_get_documents' by focusing on creation rather than retrieval. However, it doesn't explicitly differentiate from other creation tools like 'notes_create_note' or 'workflow_contact_to_textedit', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., TextEdit availability), exclusions, or comparisons to similar tools like 'notes_create_note' or 'workflow_contact_to_textedit'. This leaves the agent with minimal context for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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