Skip to main content
Glama

get_file_info

Retrieve file metadata including download URL for a specific file in a Canvas course. Provide course ID and file ID to get the file's details.

Instructions

Get file metadata including download url.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYes
file_idYes

Implementation Reference

  • The MCP tool handler for 'get_file_info'. It accepts course_id and file_id, and calls the Canvas API to fetch file metadata including download URL.
    @mcp.tool()
    def get_file_info(course_id: int, file_id: int) -> dict:
        """Get file metadata including download url."""
        return _get(f"/api/v1/courses/{course_id}/files/{file_id}")
  • The tool is registered via the @mcp.tool() decorator from FastMCP, which is defined on line 14 with 'mcp = FastMCP("canvas-local")'.
    @mcp.tool()
    def get_file_info(course_id: int, file_id: int) -> dict:
  • Helper function that performs the actual HTTP GET request against the Canvas API. Since get_file_info returns a single dict (not a list), _get returns the JSON response directly (the else branch on line 42).
    def _get(path: str, **params) -> Any:
        params.setdefault("per_page", 100)
        url = f"{BASE}{path}"
        out = []
        with httpx.Client(headers=HEAD, timeout=30) as c:
            while url:
                r = c.get(url, params=params)
                r.raise_for_status()
                data = r.json()
                if isinstance(data, list):
                    out.extend(data)
                else:
                    return data
                url = None
                params = {}
                link = r.headers.get("Link", "")
                for part in link.split(","):
                    if 'rel="next"' in part:
                        url = part[part.find("<")+1:part.find(">")]
        return out
Behavior2/5

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

With no annotations provided, the description must disclose behavioral traits. It only states it gets metadata, but omits any side effects, error scenarios, or access requirements. Minimal behavioral insight.

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?

Description is a single efficient sentence with no wasted words. However, it could be slightly expanded to include more context without harming conciseness.

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 output schema, the description should explain the return value more thoroughly. Mentioning 'metadata including download url' is insufficient; it lacks details on other metadata fields, error handling, and required permissions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and the description adds no meaning to the parameters (course_id, file_id). It does not explain their roles or expected values beyond what the schema already shows.

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

Purpose5/5

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

Description clearly states the verb 'Get' and the resource 'file metadata', and specifies a key detail 'including download url'. This distinguishes it from sibling tools like get_grades or list_courses which have different resources.

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 on when to use this tool versus alternatives like list_courses or get_page. No prerequisites or exclusion criteria mentioned.

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/admin978/canvas-mcp'

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