Skip to main content
Glama
bazylhorsey
by bazylhorsey

create_canvas

Create a new canvas file in your Obsidian vault to organize notes and ideas visually. Specify the vault name and file path to generate the canvas.

Instructions

Create a new canvas file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath for new canvas
vaultYesVault name

Implementation Reference

  • Core handler function that creates an empty Obsidian canvas file by writing a minimal CanvasData JSON structure to the specified vault path.
    async createCanvas(vaultPath: string, canvasPath: string): Promise<VaultOperationResult<CanvasData>> {
      const emptyCanvas: CanvasData = {
        nodes: [],
        edges: []
      };
    
      const result = await this.writeCanvas(vaultPath, canvasPath, emptyCanvas);
      if (!result.success) {
        return { success: false, error: result.error };
      }
    
      return { success: true, data: emptyCanvas };
    }
  • Input schema definition for the create_canvas tool, specifying required vault and path parameters.
      name: 'create_canvas',
      description: 'Create a new canvas file',
      inputSchema: {
        type: 'object',
        properties: {
          vault: { type: 'string', description: 'Vault name' },
          path: { type: 'string', description: 'Path for new canvas' },
        },
        required: ['vault', 'path'],
      },
    },
  • src/index.ts:652-661 (registration)
    MCP server tool call handler that routes create_canvas requests to the CanvasService by resolving the vault connector and passing vaultPath and canvas path.
    case 'create_canvas': {
      const connector = this.connectors.get(args?.vault as string);
      if (!connector || !connector.vaultPath) {
        throw new Error(`Vault "${args?.vault}" not found or not a local vault`);
      }
      const result = await this.canvasService.createCanvas(connector.vaultPath, args?.path as string);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }

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/bazylhorsey/obsidian-mcp-server'

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