getCollections
Retrieve all collection schemas from the Directus CMS API using the Model Context Protocol. Simplify schema management by accessing structured data without manual configuration.
Instructions
Get all collection schemas from Directus
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | No | Authentication token (default from config) | |
| url | No | Directus API URL (default from config) |
Implementation Reference
- index.ts:248-265 (registration)Registration of the 'getCollections' tool in the ListTools response, including its name, description, and input schema definition.{ name: "getCollections", description: "Get all collection schemas 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)" } }, required: [] } },
- index.ts:565-581 (handler)Handler implementation for the 'getCollections' tool within the CallToolRequestHandler switch statement. Fetches all collections from the Directus API /collections endpoint using axios and returns the JSON response.case "getCollections": { const token = toolArgs.token || CONFIG.DIRECTUS_ACCESS_TOKEN; const response = await axios.get( `${url}/collections`, { headers: buildHeaders(token) } ); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2) } ] }; }