Skip to main content
Glama
jagoff

obsidian-mcp-complete

by jagoff

obsidian_put_active

Destructive

Replace the body of the currently active note in Obsidian with new content. Uses the local REST API to update the note.

Instructions

Replace the currently active note body through Local REST API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes

Implementation Reference

  • src/tools.ts:1222-1228 (registration)
    Registration of the 'obsidian_put_active' tool in registerObsidianTools(). Defines schema (content: string) and handler that calls obsidianRestRequest with PUT method to /active/.
    tool(
      "obsidian_put_active",
      "Replace the currently active note body through Local REST API.",
      { content: z.string() },
      async (args) => obsidianRestRequest(config, { method: "PUT", path: "/active/", body: args.content, contentType: "text/markdown" }),
      { destructiveHint: true },
    );
  • The handler function for obsidian_put_active. Sends a PUT request to the Obsidian Local REST API /active/ endpoint with the provided content as text/markdown.
    async (args) => obsidianRestRequest(config, { method: "PUT", path: "/active/", body: args.content, contentType: "text/markdown" }),
    { destructiveHint: true },
  • Input schema for obsidian_put_active: requires a single 'content' string field.
    "Replace the currently active note body through Local REST API.",
    { content: z.string() },
  • The obsidianRestRequest function that executes the actual HTTP request to the Obsidian Local REST API. Used by the obsidian_put_active handler.
    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);
    }
Behavior2/5

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

Annotations already indicate destructiveHint=true and readOnlyHint=false, which align with the description's 'Replace' implying mutation. However, the description adds no additional behavioral context beyond what annotations provide, such as impact on note metadata or versioning.

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

Conciseness3/5

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

The description is a single concise sentence that gets to the point, but it lacks structure and details. It is front-loaded with the action but omits essential information that would warrant higher conciseness.

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 no output schema and many sibling tools, the description is incomplete. It does not specify what 'active note' means, success/failure conditions, or how this relates to other similar endpoints like obsidian_patch_active.

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 input schema has one required parameter 'content' with no description. The description does not clarify what format the content should be (e.g., Markdown, plain text) or how it replaces the existing body, leaving ambiguity.

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 it replaces the body of the active note, providing a specific verb and resource. However, it does not differentiate from sibling tools like obsidian_patch_active or obsidian_post_active, which may perform similar actions.

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 such as obsidian_patch_active or obsidian_post_active. There is no mention of prerequisites, context, or scenarios where this tool is preferred.

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