Skip to main content
Glama
jagoff

obsidian-mcp-complete

by jagoff

obsidian_rest_request

Send custom GET, POST, PUT, PATCH, or DELETE requests to the Obsidian Local REST API for unsupported operations. Requires OBSIDIAN_API_KEY.

Instructions

Escape hatch for Obsidian Local REST API requests. Requires OBSIDIAN_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNoGET
pathYes
bodyNo
contentTypeNo
timeoutMsNo

Implementation Reference

  • The core function that executes the REST request logic: builds URL, sets auth headers, handles body serialization, performs fetch with timeout/abort, and returns parsed response.
    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);
      }
    }
  • Type definition for RestRequestOptions used by the obsidianRestRequest function.
    export type RestRequestOptions = {
      method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
      path: string;
      body?: unknown;
      contentType?: string;
      timeoutMs?: number;
    };
  • src/tools.ts:1193-1205 (registration)
    Registration of the 'obsidian_rest_request' tool with its schema (method, path, body, contentType, timeoutMs) and handler that delegates to obsidianRestRequest(config, args).
    tool(
      "obsidian_rest_request",
      "Escape hatch for Obsidian Local REST API requests. Requires OBSIDIAN_API_KEY.",
      {
        method: z.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).optional().default("GET"),
        path: z.string(),
        body: z.unknown().optional(),
        contentType: z.string().optional(),
        timeoutMs: z.number().int().min(1000).max(120000).optional().default(15000),
      },
      async (args) => obsidianRestRequest(config, args),
      { destructiveHint: false },
    );
Behavior2/5

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

Annotations provide basic safety flags (readOnlyHint false, destructiveHint false, etc.) but the description adds no additional behavioral context beyond stating that an API key is required. It does not explain the potential consequences of the request (e.g., that it can modify data) or any rate limits or error behavior.

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?

The description is extremely concise (two sentences) and front-loaded with the core purpose. Every sentence adds value: the first identifies the tool as an escape hatch, the second notes the required API key.

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 that this is an 'escape hatch' for arbitrary HTTP requests, the description is minimally complete. However, it omits details about the base URL, response format, or possible error states. Since there is no output schema, the agent could benefit from knowing what to expect.

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 5 parameters with 0% coverage in description or schema descriptions. The description provides no explanation of how to use parameters like 'body', 'contentType', or 'timeoutMs'. The method and path are somewhat self-explanatory, but the lack of guidance on body format or content type is a gap.

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 identifies this as an 'escape hatch' for making arbitrary REST API requests to Obsidian. The phrase 'escape hatch' immediately signals that it is a general-purpose tool, distinct from the many specific sibling operations (e.g., obsidian_create_note, obsidian_search).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implicitly states that this tool is for making custom REST API requests that are not covered by other tools, but it does not explicitly state when to use or not use it, nor does it name any specific alternatives. The requirement of OBSIDIAN_API_KEY is mentioned but without context on prerequisites.

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