Skip to main content
Glama

add_canvas_node

Add text, file, link, or group nodes to Obsidian canvas files by specifying type, content, position, and styling parameters.

Instructions

Add a new node to an Obsidian canvas

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
canvasPathYesRelative path to the .canvas file
typeYesNode type
contentYesText content, file path, URL, or group label depending on type
xNoX position
yNoY position
widthNoNode width
heightNoNode height
colorNoColor: '1'-'6' for Obsidian palette, or hex

Implementation Reference

  • The tool 'add_canvas_node' is defined and implemented here, including its input schema registration and handler function.
    server.registerTool(
      "add_canvas_node",
      {
        description: "Add a new node to an Obsidian canvas",
        inputSchema: {
          canvasPath: z.string().min(1).describe("Relative path to the .canvas file"),
          type: z.enum(["text", "file", "link", "group"]).describe("Node type"),
          content: z.string().describe("Text content, file path, URL, or group label depending on type"),
          x: z.number().optional().default(0).describe("X position"),
          y: z.number().optional().default(0).describe("Y position"),
          width: z.number().optional().default(250).describe("Node width"),
          height: z.number().optional().default(60).describe("Node height"),
          color: z.string().optional().describe("Color: '1'-'6' for Obsidian palette, or hex"),
        },
      },
      async ({ canvasPath, type, content, x, y, width, height, color }) => {
        try {
          const data = await readCanvasFile(vaultPath, canvasPath);
          const id = randomUUID();
    
          const node: CanvasNode = {
            id,
            type,
            x,
            y,
            width,
            height,
          };
    
          if (type === "text") {
            node.text = content;
          } else if (type === "file") {
            node.file = content;
          } else if (type === "link") {
            node.url = content;
          } else if (type === "group") {
            node.label = content;
          }
    
          if (color) {
            node.color = color;
          }
    
          data.nodes.push(node);
          await writeCanvasFile(vaultPath, canvasPath, data);
    
          return {
            content: [{ type: "text" as const, text: `Node added successfully.\nID: ${id}\nType: ${type}\nPosition: (${x}, ${y})` }],
          };
        } catch (err) {
          console.error("Failed to add canvas node:", err);
          return errorResult(`Error adding node: ${err instanceof Error ? err.message : String(err)}`);
        }
      },
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool adds a node but doesn't describe what happens when the operation succeeds or fails, whether it modifies existing canvas structure, if there are permission requirements, or any side effects. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a tool with comprehensive schema documentation and gets straight to the point with zero wasted verbiage.

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?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what constitutes success/failure, what the tool returns, or important behavioral aspects like whether duplicate nodes are allowed. Given the complexity of canvas manipulation and the lack of structured behavioral information, the description should provide more complete context.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all 8 parameters thoroughly with descriptions, defaults, and enums. The description adds no additional parameter information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 the action ('Add a new node') and the resource ('to an Obsidian canvas'), making the purpose immediately understandable. It distinguishes this tool from siblings like 'add_canvas_edge' (which connects nodes) and 'read_canvas' (which reads canvas content). However, it doesn't specify what a 'node' represents in Obsidian canvas context, leaving some ambiguity about the exact resource being created.

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. It doesn't mention prerequisites (e.g., needing an existing canvas file), when not to use it, or how it differs from similar tools like 'create_note' or 'append_to_note'. The agent must infer usage context solely from the tool name and parameter schema.

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/rps321321/obsidian-mcp-pro'

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