Skip to main content
Glama
bezata

kObsidian MCP

Parse Canvas

canvas.parse
Read-onlyIdempotent

Parse an Obsidian canvas file to retrieve its full node and edge structure. Use this for complete graph analysis when neighbor-only queries are insufficient. Read-only.

Instructions

Parse an Obsidian canvas file and return its full structure: every node (text, file, link, group) and every edge. Use this when you need the complete graph; for just the neighbours of a specific node, call canvas.connections instead. Read-only.

Operates on the session-active vault (see vault.current — selectable via vault.select) unless an explicit vaultPath argument is passed, which always wins.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesVault-relative path to an Obsidian `.canvas` file.
vaultPathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYes
nodesYes
edgesYes

Implementation Reference

  • Registration of the canvas.parse tool in the tool definitions array, wiring it to parseCanvas domain function.
    {
      name: "canvas.parse",
      title: "Parse Canvas",
      description:
        "Parse an Obsidian canvas file and return its full structure: every node (text, file, link, group) and every edge. Use this when you need the complete graph; for just the neighbours of a specific node, call `canvas.connections` instead. Read-only.",
      inputSchema: canvasParseArgsSchema,
      outputSchema: canvasParseOutputSchema,
      annotations: READ_ONLY,
      handler: async (context, rawArgs) => {
        const args = canvasParseArgsSchema.parse(rawArgs) as CanvasParseArgs;
        return parseCanvas(context, args);
      },
    },
  • Core handler that loads a canvas file from disk and returns its full structure (nodes, edges, counts).
    export async function parseCanvas(
      context: DomainContext,
      args: { filePath: string; vaultPath?: string },
    ) {
      const vaultRoot = requireVaultPath(context, args.vaultPath);
      const absolutePath = resolveVaultPath(vaultRoot, args.filePath);
      const canvas = await loadCanvas(absolutePath);
      return {
        filePath: args.filePath,
        nodes: canvas.nodes,
        edges: canvas.edges,
        nodeCount: canvas.nodes.length,
        edgeCount: canvas.edges.length,
      };
    }
  • Input schema for canvas.parse: requires filePath, optional vaultPath.
    export const canvasParseArgsSchema = z
      .object({
        filePath: canvasFilePathSchema,
        vaultPath: z.string().optional(),
      })
      .strict();
    export type CanvasParseArgs = z.input<typeof canvasParseArgsSchema>;
  • Output schema for canvas.parse: returns filePath, nodes, and edges arrays with passthrough for extra fields.
    export const canvasParseOutputSchema = z
      .object({
        filePath: z.string(),
        nodes: z.array(z.record(z.string(), z.unknown())),
        edges: z.array(z.record(z.string(), z.unknown())),
      })
      .passthrough();
  • Helper function used by parseCanvas to read and parse the canvas JSON file from disk.
    async function loadCanvas(filePath: string): Promise<CanvasDocument> {
      const raw = await readUtf8(filePath);
      try {
        const parsed = JSON.parse(raw) as Partial<CanvasDocument>;
        return {
          nodes: Array.isArray(parsed.nodes) ? (parsed.nodes as CanvasNode[]) : [],
          edges: Array.isArray(parsed.edges) ? (parsed.edges as CanvasEdge[]) : [],
        };
      } catch (error) {
        throw new AppError("invalid_argument", `Invalid canvas JSON: ${filePath}`, { cause: error });
      }
    }
Behavior5/5

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

Annotations already declare `readOnlyHint: true`, `destructiveHint: false`, and `idempotentHint: true`. The description adds behavioral context by stating it operates on the session-active vault unless an explicit `vaultPath` is provided, which always wins. This complements the annotations with no contradictions.

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 two short paragraphs, front-loaded with the main purpose. Every sentence adds value: purpose, usage guidance, read-only note, and vault behavior. No wasted words.

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

Completeness5/5

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

Given the tool's complexity, the presence of an output schema (which handles return structure), and annotations covering safety, the description fully covers input behavior, usage context, vault handling, and distinguishes from a sibling tool. No gaps remain.

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

Parameters4/5

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

Schema description coverage is 50% (only `filePath` is described). The description adds semantic value for `vaultPath` by explaining its override behavior and relationship to the session vault. While it doesn't fully describe the `vaultPath` parameter's format, it provides meaningful context 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 that the tool parses an Obsidian canvas file and returns its full structure, listing node types (text, file, link, group) and edges. It distinguishes itself from the sibling tool `canvas.connections` by specifying when to use each (complete graph vs. neighbours of a specific node). The verb 'Parse' is specific to the resource 'Obsidian canvas file'.

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

Usage Guidelines5/5

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

The description explicitly provides guidance: 'Use this when you need the complete graph; for just the neighbours of a specific node, call `canvas.connections` instead.' It also explains the vault scope and the override behavior of the `vaultPath` argument, helping the agent decide when to use this tool versus alternatives.

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/bezata/kObsidian'

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