Skip to main content
Glama
jagoff

obsidian-mcp-complete

by jagoff

obsidian_batch

Execute multiple note operations—read, write, move, delete, and more—in a single batch call. Stop on error option ensures data integrity.

Instructions

Execute multiple filesystem note operations in one call. Operations are best-effort unless stopOnError is true.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vaultNoOptional configured vault name. Defaults to the server default vault.
operationsYes
stopOnErrorNo

Implementation Reference

  • src/tools.ts:673-723 (registration)
    Registration of the 'obsidian_batch' tool with its schema (operations array supporting read/write/append/replace/frontmatter/move/delete) and inline handler function. The handler loops over operations and dispatches to vault methods.
    tool(
      "obsidian_batch",
      "Execute multiple filesystem note operations in one call. Operations are best-effort unless stopOnError is true.",
      {
        vault: vaultArg,
        operations: z.array(z.object({
          op: z.enum(["read", "write", "append", "replace", "frontmatter", "move", "delete"]),
          path: z.string().optional(),
          to: z.string().optional(),
          content: z.string().optional(),
          search: z.string().optional(),
          replace: z.string().optional(),
          frontmatter: z.record(z.unknown()).optional(),
          overwrite: z.boolean().optional(),
          confirmation: z.string().optional(),
        })).min(1).max(200),
        stopOnError: z.boolean().optional().default(false),
      },
      async (args) => {
        const results = [];
        for (const operation of args.operations) {
          try {
            if (!operation.path) throw new Error("path is required");
            if (operation.op === "read") {
              results.push({ ok: true, op: operation.op, note: await vaults.readText(operation.path, args.vault) });
            } else if (operation.op === "write") {
              results.push({ ok: true, op: operation.op, ...(await vaults.writeText(vaults.notePath(operation.path!), operation.content ?? "", args.vault, { overwrite: operation.overwrite })) });
            } else if (operation.op === "append") {
              results.push({ ok: true, op: operation.op, ...(await vaults.appendText(vaults.notePath(operation.path!), operation.content ?? "", args.vault, { create: true })) });
            } else if (operation.op === "replace") {
              const read = await vaults.readText(operation.path!, args.vault);
              const next = read.text.replace(new RegExp(escapeRegExp(operation.search ?? ""), "g"), operation.replace ?? "");
              await vaults.writeText(read.path, next, args.vault, { overwrite: true });
              results.push({ ok: true, op: operation.op, path: read.path });
            } else if (operation.op === "frontmatter") {
              const read = await vaults.readText(operation.path!, args.vault);
              await vaults.writeText(read.path, updateFrontmatter(read.text, operation.frontmatter ?? {}, "merge"), args.vault, { overwrite: true });
              results.push({ ok: true, op: operation.op, path: read.path });
            } else if (operation.op === "move") {
              results.push({ ok: true, op: operation.op, ...(await vaults.move(vaults.notePath(operation.path!), vaults.notePath(operation.to ?? ""), args.vault, { overwrite: operation.overwrite })) });
            } else if (operation.op === "delete") {
              results.push({ ok: true, op: operation.op, ...(await vaults.trash(vaults.notePath(operation.path!), args.vault, { confirmation: operation.confirmation })) });
            }
          } catch (error) {
            results.push({ ok: false, op: operation.op, path: operation.path, error: error instanceof Error ? error.message : String(error) });
            if (args.stopOnError) break;
          }
        }
        return { results };
      },
    );
  • Input schema for obsidian_batch: operations array (min 1, max 200 items) each with op type enum, path, to, content, search, replace, frontmatter, overwrite, confirmation fields; plus stopOnError flag.
    tool(
      "obsidian_batch",
      "Execute multiple filesystem note operations in one call. Operations are best-effort unless stopOnError is true.",
      {
        vault: vaultArg,
        operations: z.array(z.object({
          op: z.enum(["read", "write", "append", "replace", "frontmatter", "move", "delete"]),
          path: z.string().optional(),
          to: z.string().optional(),
          content: z.string().optional(),
          search: z.string().optional(),
          replace: z.string().optional(),
          frontmatter: z.record(z.unknown()).optional(),
          overwrite: z.boolean().optional(),
          confirmation: z.string().optional(),
        })).min(1).max(200),
        stopOnError: z.boolean().optional().default(false),
      },
Behavior3/5

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

Annotations provide minimal info (readOnlyHint false etc.). Description adds that operations are best-effort unless stopOnError is true, which is useful but doesn't detail error handling or side effects.

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?

Two sentences with no wasted words; essential info front-loaded.

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?

Complex nested input schema and no output schema; description is too brief. Lacks details on structuring operations, response format, and error behavior.

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

Parameters2/5

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

Schema description coverage is low (33%). Description provides no additional meaning for parameters like operations or stopOnError beyond the schema.

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

Purpose5/5

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

The description clearly states the tool executes multiple filesystem note operations in one call, distinguishing it from single-operation siblings like obsidian_create_note or obsidian_read_note.

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?

No guidance on when to use this batch tool vs individual operations. The description only mentions best-effort behavior, not conditions for choosing this tool.

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

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