Skip to main content
Glama
bezata

kObsidian MCP

Canvas Node Connections

canvas.connections
Read-onlyIdempotent

Return the incoming and outgoing edges of a single canvas node to traverse the graph step by step without loading the full document.

Instructions

Return the incoming and outgoing edges of a single canvas node. Use this to walk the canvas graph one node at a time without loading the full document. Read-only. For full-graph parsing, use canvas.parse.

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.
nodeIdYesId of the node whose edges to return.
vaultPathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYes
nodeIdYes
incomingYes
outgoingYes

Implementation Reference

  • Core handler function for 'canvas.connections'. Loads the canvas file, validates the node exists, and returns incoming/outgoing edge connections.
    export async function getCanvasNodeConnections(
      context: DomainContext,
      args: { filePath: string; nodeId: string; vaultPath?: string },
    ) {
      const vaultRoot = requireVaultPath(context, args.vaultPath);
      const absolutePath = resolveVaultPath(vaultRoot, args.filePath);
      const canvas = await loadCanvas(absolutePath);
      if (!canvas.nodes.some((node) => node.id === args.nodeId)) {
        throw new AppError("not_found", `Node not found: ${args.nodeId}`);
      }
      const incoming = canvas.edges
        .filter((edge) => edge.toNode === args.nodeId)
        .map((edge) => edge.fromNode);
      const outgoing = canvas.edges
        .filter((edge) => edge.fromNode === args.nodeId)
        .map((edge) => edge.toNode);
      return {
        filePath: args.filePath,
        nodeId: args.nodeId,
        incoming,
        outgoing,
        incomingCount: incoming.length,
        outgoingCount: outgoing.length,
      };
    }
  • Input schema for canvas.connections. Accepts filePath, nodeId, and optional vaultPath.
    export const canvasConnectionsArgsSchema = z
      .object({
        filePath: canvasFilePathSchema,
        nodeId: z.string().min(1).describe("Id of the node whose edges to return."),
        vaultPath: z.string().optional(),
      })
      .strict();
    export type CanvasConnectionsArgs = z.input<typeof canvasConnectionsArgsSchema>;
  • Output schema for canvas.connections. Returns filePath, nodeId, incoming/outgoing arrays and counts.
    export const canvasConnectionsOutputSchema = z
      .object({
        filePath: z.string(),
        nodeId: z.string(),
        incoming: z.array(z.record(z.string(), z.unknown())),
        outgoing: z.array(z.record(z.string(), z.unknown())),
      })
      .passthrough();
  • Tool registration for 'canvas.connections'. Defines name, title, description, input/output schemas, annotations, and wraps the handler that calls getCanvasNodeConnections.
    {
      name: "canvas.connections",
      title: "Canvas Node Connections",
      description:
        "Return the incoming and outgoing edges of a single canvas node. Use this to walk the canvas graph one node at a time without loading the full document. Read-only. For full-graph parsing, use `canvas.parse`.",
      inputSchema: canvasConnectionsArgsSchema,
      outputSchema: canvasConnectionsOutputSchema,
      annotations: READ_ONLY,
      handler: async (context, rawArgs) => {
        const args = canvasConnectionsArgsSchema.parse(rawArgs) as CanvasConnectionsArgs;
        return getCanvasNodeConnections(context, args);
      },
    },
  • Top-level tool registry that collects all tools including canvasTools into a single array for server registration.
    export const toolRegistry: ToolDefinition[] = [
      ...vaultTools,
      ...noteTools,
      ...tagTools,
      ...linkTools,
      ...analyticsTools,
      ...taskTools,
      ...dataviewTools,
      ...blocksTools,
      ...marpTools,
      ...kanbanTools,
      ...canvasTools,
      ...templateTools,
      ...apiTools,
      ...wikiTools,
      ...systemTools,
    ];
Behavior5/5

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

Description states 'Read-only' aligning with annotations. Adds critical context about operating on the session-active vault unless vaultPath is provided, which annotations do not cover. 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?

Three concise sentences with no fluff. First sentence states core purpose, second gives usage guidance, third explains vault behavior. Front-loaded and efficient.

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 output schema exists (so return format is documented elsewhere), the description fully covers purpose, usage, alternative, and behavioral nuance (vault handling). No gaps identified.

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 coverage is 67% with descriptions for filePath and nodeId. Description adds behavior of vaultPath ('always wins') but does not provide format or constraints for it, leaving some ambiguity.

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 it returns incoming and outgoing edges of a single canvas node, with a specific verb ('Return') and resource ('edges of a single canvas node'). It differentiates from sibling tool 'canvas.parse' by contrasting one-at-a-time vs full-graph.

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?

Explicitly says 'Use this to walk the canvas graph one node at a time without loading the full document' and 'For full-graph parsing, use `canvas.parse`.' Also explains vault behavior with references to vault.current and vault.select.

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