Skip to main content
Glama

get_canvas

Retrieve canvas file contents from Obsidian vaults to access and work with visual knowledge maps and structured content.

Instructions

Get canvas file contents

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to canvas file
vaultYesVault name

Implementation Reference

  • src/index.ts:216-225 (registration)
    Registration of the 'get_canvas' tool including name, description, and input schema.
    name: 'get_canvas', description: 'Get canvas file contents', inputSchema: { type: 'object', properties: { vault: { type: 'string', description: 'Vault name' }, path: { type: 'string', description: 'Path to canvas file' }, }, required: ['vault', 'path'], },
  • Handler case for 'get_canvas' tool that retrieves the connector and calls CanvasService.readCanvas.
    case 'get_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.readCanvas(connector.vaultPath, args?.path as string); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • Core implementation of get_canvas: reads the canvas file from the vault path and parses its JSON content.
    async readCanvas(vaultPath: string, canvasPath: string): Promise<VaultOperationResult<CanvasData>> { try { const fullPath = path.join(vaultPath, canvasPath); const content = await fs.readFile(fullPath, 'utf-8'); const data: CanvasData = JSON.parse(content); return { success: true, data }; } catch (error) { return { success: false, error: `Failed to read canvas: ${error instanceof Error ? error.message : String(error)}` }; } }

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