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

NameRequiredDescriptionDefault
file_idYesID of the file

Input Schema (JSON Schema)

{ "properties": { "file_id": { "description": "ID of the file", "type": "number" } }, "required": [ "file_id" ], "type": "object" }

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; }

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