Skip to main content
Glama

logout

Invalidate the current authentication token to end your session. This revokes access and logs you out.

Instructions

Invalidate the current token and end the session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The logout tool handler. Invalidates the current token by calling /tokens/invalidate API, clears authToken and connectionVerified, and handles errors gracefully.
    server.tool("logout", "Invalidate the current token and end the session", {}, async () => {
        try {
            if (!apiUrlSet) {
                return {
                    isError: true,
                    content: [{
                            type: "text",
                            text: "API URL not set. Please set the API URL first using the set-api-url tool."
                        }]
                };
            }
            if (!authToken) {
                return {
                    isError: true,
                    content: [{ type: "text", text: "Not authenticated yet. No need to logout." }]
                };
            }
            await authenticatedRequest("/tokens/invalidate", "POST");
            authToken = null;
            connectionVerified = false;
            return {
                content: [{
                        type: "text",
                        text: "Logged out successfully. Token invalidated."
                    }]
            };
        }
        catch (error) {
            authToken = null; // Force logout even if API call fails
            connectionVerified = false;
            return {
                isError: true,
                content: [{ type: "text", text: `Error during logout: ${getErrorMessage(error)}. Token cleared locally.` }]
            };
        }
    });
  • build/index.js:537-537 (registration)
    Registration of the 'logout' tool via server.tool() with description and empty schema.
    server.tool("logout", "Invalidate the current token and end the session", {}, async () => {
Behavior3/5

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

The description mentions token invalidation and session end, indicating destructive behavior. No annotations provided, so description carries the burden; could be more detailed about effects or prerequisites.

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?

Single sentence, concise, and front-loaded with essential information. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with no parameters or output schema, the description is adequate. It could mention if authentication is required or the return value, but it's reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters are defined in the schema, so the description does not need to add parameter information. Baseline for 0 parameters is 4.

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

Purpose5/5

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

The description clearly states the tool invalidates the current token and ends the session, which is a specific action. It is distinct from sibling tools like authenticate or keep-session-alive.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use or alternatives. Context implies it's the opposite of authenticate and keep-session-alive, but no direct statement.

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

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/mingzilla/pi-api-mcp-server'

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