Skip to main content
Glama
bazylhorsey
by bazylhorsey

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)}`
        };
      }
    }
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 a read operation ('Get'), implying it's likely non-destructive and read-only, but doesn't confirm this or add context such as authentication needs, rate limits, or what happens if the file doesn't exist. It lacks details on return format or error handling, leaving significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence ('Get canvas file contents') that is front-loaded and wastes no words. However, it could be slightly more informative without losing conciseness, such as by hinting at the output type. It earns a high score for being direct and to the point.

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?

Given the tool has no annotations, no output schema, and 2 required parameters, the description is incomplete. It doesn't explain what 'contents' includes (e.g., file data, structure), potential errors, or how it differs from similar tools like 'get_note'. For a read operation with no structured support, more context is needed to be fully helpful.

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?

The input schema has 100% description coverage, with parameters 'path' and 'vault' clearly documented in the schema. The description adds no additional meaning beyond what the schema provides, such as examples or constraints. With high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get canvas file contents' clearly states the action (get) and resource (canvas file contents), but it's vague about what 'contents' entails (e.g., raw data, metadata, structure) and doesn't distinguish from siblings like 'get_note' or 'list_canvas_files'. It avoids tautology by not restating the name/title, but lacks specificity.

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?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't clarify if this is for retrieving raw canvas data versus using 'get_note' for notes or 'list_canvas_files' for listings, nor does it mention prerequisites like vault access. The description implies usage but offers no explicit context or exclusions.

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

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