Skip to main content
Glama

getFiles

Retrieve files from the Directus CMS API using specified URL, token, and optional query parameters. Facilitates file management within the Model Context Protocol framework.

Instructions

Get files from Directus

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoQuery parameters like filter, sort, limit, etc. (optional)
tokenNoAuthentication token (default from config)
urlNoDirectus API URL (default from config)

Implementation Reference

  • Handler for the 'getFiles' tool. Fetches files from Directus API endpoint '/files' using axios GET with optional query parameters and authentication token.
    case "getFiles": {
      const token = toolArgs.token || CONFIG.DIRECTUS_ACCESS_TOKEN;
      const query = toolArgs.query as Record<string, any> | undefined;
      
      const response = await axios.get(
        `${url}/files`,
        { 
          headers: buildHeaders(token),
          params: query
        }
      );
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(response.data, null, 2)
          }
        ]
      };
    }
  • Input schema definition for the 'getFiles' tool, specifying optional parameters for URL, token, and query.
    inputSchema: {
      type: "object",
      properties: {
        url: { 
          type: "string", 
          description: "Directus API URL (default from config)"
        },
        token: { 
          type: "string", 
          description: "Authentication token (default from config)"
        },
        query: {
          type: "object",
          description: "Query parameters like filter, sort, limit, etc. (optional)"
        }
      },
      required: []
    }
  • index.ts:354-375 (registration)
    Registration of the 'getFiles' tool in the listTools response, including name, description, and input schema.
    {
      name: "getFiles",
      description: "Get files from Directus",
      inputSchema: {
        type: "object",
        properties: {
          url: { 
            type: "string", 
            description: "Directus API URL (default from config)"
          },
          token: { 
            type: "string", 
            description: "Authentication token (default from config)"
          },
          query: {
            type: "object",
            description: "Query parameters like filter, sort, limit, etc. (optional)"
          }
        },
        required: []
      }
    },
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without disclosing behavioral traits. It doesn't mention if this is read-only, pagination behavior, error handling, rate limits, or authentication needs beyond the token parameter. Significant gaps exist for a tool with potential complexity.

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 extremely concise with a single sentence, front-loaded and zero waste. Every word earns its place, though this brevity contributes to gaps in other dimensions.

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, no output schema, and a tool that likely returns complex data (files with metadata), the description is incomplete. It doesn't explain return values, error cases, or how it interacts with the Directus system, leaving the agent with insufficient context.

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%, so the schema already documents all parameters. The description adds no additional meaning about parameters beyond what the schema provides, such as explaining query structure or default behavior. Baseline 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 files from Directus' states the basic action (get) and resource (files from Directus), but it's vague about scope and doesn't distinguish from siblings like getItems or getItem. It lacks specificity about what 'files' means in this context.

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 like getItems (which might handle files too) or uploadFile. The description doesn't mention prerequisites, context, or exclusions, leaving usage unclear.

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/pixelsock/directus-mcp'

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