Skip to main content
Glama
jagoff

obsidian-mcp-complete

by jagoff

obsidian_post_active

Append Markdown content to the active note in Obsidian using the Local REST API. Ideal for quickly adding notes or data without switching contexts.

Instructions

Append Markdown to the currently active note through Local REST API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes

Implementation Reference

  • Registration and handler for obsidian_post_active tool. It calls obsidianRestRequest with POST method to /active/ endpoint, sending the content as text/markdown to append Markdown to the currently active note via the Obsidian Local REST API.
    tool(
      "obsidian_post_active",
      "Append Markdown to the currently active note through Local REST API.",
      { content: z.string() },
      async (args) => obsidianRestRequest(config, { method: "POST", path: "/active/", body: args.content, contentType: "text/markdown" }),
    );
  • Schema for the tool: requires a single string parameter 'content' validated by Zod.
    { content: z.string() },
  • src/tools.ts:1215-1220 (registration)
    Registration via the local 'tool' function on line 41-60, which wraps server.tool from the MCP SDK.
    tool(
      "obsidian_post_active",
      "Append Markdown to the currently active note through Local REST API.",
      { content: z.string() },
      async (args) => obsidianRestRequest(config, { method: "POST", path: "/active/", body: args.content, contentType: "text/markdown" }),
    );
  • The underlying helper function that makes the actual HTTP POST request to the Obsidian Local REST API. It handles auth headers, content-type, timeout, and response parsing.
    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);
    }
Behavior3/5

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

Annotations already indicate non-read-only, non-destructive, non-idempotent. Description adds that it appends Markdown via Local REST API, but does not discuss error conditions or behavior when no active note exists. Adequate but minimal.

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

Conciseness4/5

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

Description is one sentence with 11 words, no redundancy. Very concise, though it sacrifices useful detail. Good front-loading of action and target.

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 low complexity (1 param, no output schema) and presence of annotations, the description covers basic purpose and mechanism. However, it lacks guidance on preconditions, error handling, and expected behavior for edge cases. Adequate for a simple tool but not comprehensive.

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 has 0% description coverage for the single required 'content' parameter. The description only implies content is Markdown but does not specify format, length, or constraints. Insufficient compensation for missing schema descriptions.

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?

Description clearly states it appends Markdown to the currently active note, distinguishing it from siblings that target specific notes or perform other operations (e.g., obsidian_append_to_note vs active, obsidian_patch_active). However, no explicit contrast with siblings.

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. Does not mention prerequisites (e.g., an active note must exist) or exclusions. Usage is implied only.

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