Skip to main content
Glama
YanceyOfficial

Obsidian iCloud MCP

edit_file

Modify and review text in Obsidian vault files stored in iCloud Drive. Preview changes with dry-run mode; original files update only after user confirmation. Works within specified directories.

Instructions

Edit a specific file under /Users/username/Library/Mobile Documents/iCloud~md~obsidian/Documents/my-vault. Display the modified content to the user for review; the original file will only be updated upon user confirmation. Only works within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dryRunNoPreview changes before real editing.
newTextYes
pathYes

Implementation Reference

  • The editFile function implements the core logic of the 'edit_file' tool: validates input with EditFileArgsSchema, writes new content to the file unless dryRun is true, and returns the new text.
    export async function editFile(args?: Record<string, unknown>) {
      const parsed = EditFileArgsSchema.safeParse(args)
      if (!parsed.success) {
        throw new Error(`Invalid arguments for edit_file: ${parsed.error}`)
      }
    
      if (!parsed.data.dryRun) {
        await fs.writeFile(parsed.data.path, parsed.data.newText)
      }
    
      return {
        content: [{ type: 'text', text: parsed.data.newText }]
      }
    }
  • Zod schema for EditFileArgsSchema defining path (string), newText (string), and optional dryRun (boolean).
    export const EditFileArgsSchema = z.object({
      path: z.string(),
      newText: z.string(),
      dryRun: z
        .boolean()
        .default(false)
        .describe('Preview changes before real editing.')
    })
  • src/index.ts:116-118 (registration)
    Registers the 'edit_file' tool in the ListToolsRequest handler with name, dynamic description from editFilePrompt, and input schema converted to JSON schema.
    name: 'edit_file',
    description: editFilePrompt(args),
    inputSchema: zodToJsonSchema(EditFileArgsSchema) as ToolInput
  • src/index.ts:183-185 (registration)
    In the CallToolRequest switch statement, routes calls to 'edit_file' to the editFile handler function.
    case 'edit_file': {
      return editFile(args)
    }
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses key behavioral traits: the user confirmation workflow, directory restrictions, and preview capability (implied by 'dryRun' parameter). However, it lacks details on error handling, permissions needed, or what 'allowed directories' specifically means. For a mutation tool with zero annotation coverage, this is adequate but leaves gaps.

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 front-loaded with the core purpose, followed by key behavioral details in two concise sentences. Every sentence adds value: the first defines the action and scope, the second explains the user confirmation workflow and directory restriction. No wasted words.

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

Completeness3/5

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

Given a mutation tool with 3 parameters, no annotations, and no output schema, the description is moderately complete. It covers the purpose, workflow, and scope, but lacks details on return values, error cases, or specific parameter semantics. For this complexity level, it's adequate but could be more comprehensive.

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?

Schema description coverage is low at 33% (only 'dryRun' has a description). The description adds some context: it implies 'path' must be within the specified directory and 'newText' is the content to edit. However, it doesn't explain parameter formats (e.g., path syntax) or constraints beyond the directory scope. With low schema coverage, the description compensates partially but not fully.

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 ('Edit') and resource ('a specific file'), and specifies the scope ('under /Users/username/Library/Mobile Documents/iCloud~md~obsidian/Documents/my-vault'). It distinguishes from siblings like 'write_file' by emphasizing user confirmation and preview capabilities. However, it doesn't explicitly contrast with 'write_file' which might be a direct alternative.

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

Usage Guidelines4/5

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

The description provides clear context: 'Only works within allowed directories' sets a boundary, and 'Display the modified content... upon user confirmation' indicates a workflow. It implies usage for interactive editing with safety checks, but doesn't explicitly state when to choose this over 'write_file' or other file manipulation tools.

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

Related 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/YanceyOfficial/obsidian-mcp'

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