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) }

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