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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path for new canvas | |
| vault | Yes | Vault name |
Implementation Reference
- src/services/CanvasService.ts:109-121 (handler)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 }; }
- src/index.ts:228-238 (schema)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) }], }; }