Skip to main content
Glama

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
NameRequiredDescriptionDefault
tokenNoAuthentication token (default from config)
urlNoDirectus 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: [] } },
  • 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) } ] }; }

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