Skip to main content
Glama

login

Authenticate into the Directus CMS API to generate an access token using the MCP Server, enabling interaction with collections, items, files, and system data.

Instructions

Login to Directus and get an access token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailNoUser email (default from config)
passwordNoUser password (default from config)
urlNoDirectus API URL (default from config)

Implementation Reference

  • Handler for the 'login' tool within the switch statement in CallToolRequestSchema. It extracts email/password from args or config, calls getAuthToken, and returns the access token as text content.
    case "login": {
      const email = toolArgs.email || CONFIG.DIRECTUS_EMAIL;
      const password = toolArgs.password || CONFIG.DIRECTUS_PASSWORD;
      
      const token = await getAuthToken(url, email, password);
      
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({ access_token: token }, null, 2)
          }
        ]
      };
    }
  • Schema definition for the 'login' tool, including name, description, and inputSchema, registered in the ListToolsRequestSchema response.
    name: "login",
    description: "Login to Directus and get an access token",
    inputSchema: {
      type: "object",
      properties: {
        url: { 
          type: "string", 
          description: "Directus API URL (default from config)"
        },
        email: { 
          type: "string", 
          description: "User email (default from config)"
        },
        password: { 
          type: "string", 
          description: "User password (default from config)"
        }
      },
      required: []
    }
  • index.ts:266-287 (registration)
    Registration of the 'login' tool in the tools list returned by listTools handler.
    {
      name: "login",
      description: "Login to Directus and get an access token",
      inputSchema: {
        type: "object",
        properties: {
          url: { 
            type: "string", 
            description: "Directus API URL (default from config)"
          },
          email: { 
            type: "string", 
            description: "User email (default from config)"
          },
          password: { 
            type: "string", 
            description: "User password (default from config)"
          }
        },
        required: []
      }
    },
  • Helper function getAuthToken that performs the HTTP POST to /auth/login endpoint using axios to obtain the access token.
    async function getAuthToken(url: string, email: string, password: string): Promise<string> {
      try {
        const response = await axios.post(`${url}/auth/login`, {
          email,
          password
        });
        
        return response.data.data.access_token;
      } catch (error: any) {
        throw new Error(`Authentication failed: ${error.message}`);
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool logs in and retrieves a token, implying a write operation that changes state (authentication). However, it doesn't disclose critical behaviors like token expiration, required permissions, error conditions, or rate limits, which are essential for safe and effective use.

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—a single sentence that directly states the tool's purpose without any fluff. It is front-loaded and wastes no words, making it easy for an agent to parse quickly. Every part of the sentence earns its place by conveying essential information.

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 the complexity of an authentication tool with no annotations and no output schema, the description is insufficient. It doesn't explain the return value (e.g., token format, expiration), error handling, or dependencies on other tools. For a critical operation like login, more context is needed to ensure proper integration and usage.

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?

The schema description coverage is 100%, with all three parameters ('email', 'password', 'url') well-documented in the input schema. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or default behavior details. This meets the baseline for high schema coverage but doesn't enhance understanding.

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

Purpose4/5

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

The description clearly states the action ('Login to Directus') and the outcome ('get an access token'), which is specific and actionable. It distinguishes itself from sibling tools like 'getCurrentUser' or 'getUsers' by focusing on authentication rather than data retrieval. However, it doesn't explicitly contrast with other tools, keeping it from a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives or prerequisites for its use. It doesn't mention if this is required before other operations, if tokens expire, or if there are other authentication methods available. This lack of context leaves the agent without clear usage instructions.

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