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
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Query parameters like filter, sort, limit, etc. (optional) | |
| token | No | Authentication token (default from config) | |
| url | No | Directus API URL (default from config) |
Implementation Reference
- index.ts:777-797 (handler)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) } ] }; }
- index.ts:357-374 (schema)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: [] } },