Skip to main content
Glama
jagoff

obsidian-mcp-complete

by jagoff

obsidian_delete_active

Destructive

Delete the currently active note in an Obsidian vault using the Local REST API. Requires a confirmation string 'DELETE' to proceed.

Instructions

Delete the active note through Local REST API. Commands/delete must be explicitly enabled by configuration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
confirmationYes

Implementation Reference

  • src/tools.ts:1246-1255 (registration)
    Tool registration for 'obsidian_delete_active' in the registerObsidianTools function. Defines schema (confirmation: 'DELETE') and handler.
    tool(
      "obsidian_delete_active",
      "Delete the active note through Local REST API. Commands/delete must be explicitly enabled by configuration.",
      { confirmation: z.literal("DELETE") },
      async () => {
        if (!config.enableCommands) throw new Error("Set OBSIDIAN_ENABLE_COMMANDS=1 to enable active-note delete.");
        return obsidianRestRequest(config, { method: "DELETE", path: "/active/" });
      },
      { destructiveHint: true },
    );
  • Handler function for obsidian_delete_active: checks enableCommands config, then sends DELETE request to /active/ via obsidianRestRequest.
      "obsidian_delete_active",
      "Delete the active note through Local REST API. Commands/delete must be explicitly enabled by configuration.",
      { confirmation: z.literal("DELETE") },
      async () => {
        if (!config.enableCommands) throw new Error("Set OBSIDIAN_ENABLE_COMMANDS=1 to enable active-note delete.");
        return obsidianRestRequest(config, { method: "DELETE", path: "/active/" });
      },
      { destructiveHint: true },
    );
  • Input schema for obsidian_delete_active: requires confirmation field with literal 'DELETE' value.
    { confirmation: z.literal("DELETE") },
  • obsidianRestRequest helper function that performs the actual HTTP DELETE request to the Obsidian Local REST API.
    export async function obsidianRestRequest(config: ObsidianMcpConfig, options: RestRequestOptions): Promise<{
      status: number;
      ok: boolean;
      contentType: string;
      body: unknown;
    }> {
      if (!config.restApiKey) throw new Error("OBSIDIAN_API_KEY is not configured");
      if (config.restInsecureTls) process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
      const url = new URL(options.path.replace(/^\/+/, ""), `${config.restUrl.replace(/\/+$/, "")}/`);
      const controller = new AbortController();
      const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 15000);
      try {
        const headers: Record<string, string> = {
          Authorization: `Bearer ${config.restApiKey}`,
        };
        let body: string | undefined;
        if (options.body !== undefined) {
          if (typeof options.body === "string") {
            body = options.body;
            headers["Content-Type"] = options.contentType ?? "text/markdown";
          } else {
            body = JSON.stringify(options.body);
            headers["Content-Type"] = options.contentType ?? "application/json";
          }
        }
        const response = await fetch(url, {
          method: options.method ?? "GET",
          headers,
          body,
          signal: controller.signal,
        });
        const contentType = response.headers.get("content-type") ?? "";
        const text = await response.text();
        let parsed: unknown = text;
        if (contentType.includes("application/json")) {
          try {
            parsed = JSON.parse(text);
          } catch {
            parsed = text;
          }
        }
        return { status: response.status, ok: response.ok, contentType, body: parsed };
      } finally {
        clearTimeout(timeout);
      }
    }
    
    export async function getRestText(config: ObsidianMcpConfig, path: string): Promise<string> {
      const response = await obsidianRestRequest(config, { path });
      if (!response.ok) throw new Error(`Obsidian REST returned ${response.status}: ${String(response.body)}`);
      return typeof response.body === "string" ? response.body : JSON.stringify(response.body);
    }
  • enableCommands config field in ObsidianMcpConfig type, used by the handler to gate active-note delete functionality.
    enableCommands: boolean;
    enableUiOpen: boolean;
Behavior4/5

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

Annotations already mark destructiveHint=true, but the description adds important context that the command must be explicitly enabled in configuration. This provides value beyond the annotations.

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 concise sentences with no wasted words. Front-loads the essential purpose.

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

Completeness4/5

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

For a simple destructive operation with confirmation, the description covers the key aspects: what it does, the requirement for enabling the command, and implicit safety (confirmation). No output schema exists, but the return value is not critical for a delete action.

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?

The single parameter 'confirmation' has a const value 'DELETE' and is required. The description does not explain its purpose or that it is a safety measure, and schema coverage is 0%.

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 states the tool deletes the active note via Local REST API, which is specific and distinguishes it from other delete tools like obsidian_delete_note. It also notes that the command must be explicitly enabled.

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 tool versus alternatives such as obsidian_delete_note or obsidian_delete_folder. The description does not mention use cases or exclusions.

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