Skip to main content
Glama

canvas_get_file

Retrieve detailed information about a specific file in Canvas LMS by providing its file ID using this tool within the Canvas MCP Server V2.0.

Instructions

Get information about a specific file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_idYesID of the file

Implementation Reference

  • src/index.ts:1071-1073 (registration)
    Registration of all tools including canvas_get_file via ListToolsRequestSchema handler returning the TOOLS array
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: TOOLS
    }));
  • Tool schema definition for canvas_get_file in the TOOLS array used for tool listing
      name: "canvas_get_file",
      description: "Get information about a specific file",
      inputSchema: {
        type: "object",
        properties: {
          file_id: { type: "number", description: "ID of the file" }
        },
        required: ["file_id"]
      }
    },
  • Handler implementation in CallToolRequestSchema switch that extracts file_id, calls CanvasClient.getFile, and returns JSON response
    case "canvas_get_file": {
      const { file_id } = args as { file_id: number };
      if (!file_id) throw new Error("Missing required field: file_id");
      
      const file = await this.client.getFile(file_id);
      return {
        content: [{ type: "text", text: JSON.stringify(file, null, 2) }]
      };
    }
  • CanvasClient helper method that performs the actual API call to retrieve file details from Canvas API
    async getFile(fileId: number): Promise<CanvasFile> {
      const response = await this.client.get(`/files/${fileId}`);
      return response.data;
    }
  • TypeScript interface defining the CanvasFile type returned by getFile
    export interface CanvasFile {
      id: number;
      uuid: string;
      folder_id: number;
      display_name: string;
      filename: string;
      content_type: string;
      url: string;
      size: number;
      created_at: string;
      updated_at: string;
      unlock_at?: string;
      locked: boolean;
      hidden: boolean;
      lock_at?: string;
      hidden_for_user: boolean;
      thumbnail_url?: string;
      modified_at: string;
      mime_class: string;
      media_entry_id?: string;
      locked_for_user: boolean;
      lock_explanation?: string;
      preview_url?: string;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states it 'gets information,' implying a read-only operation, but doesn't disclose behavioral traits such as authentication requirements, rate limits, error handling (e.g., for invalid file_id), or what happens if the file is inaccessible. This is a significant gap for a tool with no annotation coverage.

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 with zero waste. It's front-loaded with the core purpose, making it easy to parse quickly. Every word earns its place without redundancy or fluff.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what information is returned (e.g., file details, content, metadata), error conditions, or usage context. For a tool with 1 parameter and no structured output documentation, more detail is needed to guide effective use.

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%, with the parameter 'file_id' documented as 'ID of the file' in the schema. The description adds no additional meaning beyond this, such as format examples (e.g., numeric ID) or where to obtain the ID. Baseline 3 is appropriate since 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 information about a specific file' clearly states the verb ('Get') and resource ('file'), but it's vague about what information is retrieved (e.g., metadata, content, permissions). It distinguishes from siblings like 'canvas_list_files' by focusing on a single file, but doesn't specify how it differs from other 'get_' tools (e.g., 'canvas_get_assignment').

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. It doesn't mention prerequisites (e.g., needing a valid file_id), exclusions (e.g., not for listing files), or comparisons to siblings like 'canvas_list_files' for multiple files or 'canvas_get_page' for different resource types.

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

Related 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/DMontgomery40/mcp-canvas-lms'

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