Skip to main content
Glama

logout

Invalidate the current authentication token to securely end your session with the PI Dashboard API.

Instructions

Invalidate the current token and end the session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • build/index.js:536-572 (registration)
    Registration and handler implementation of the 'logout' tool. It checks if API URL and auth token are set, calls the /tokens/invalidate endpoint to invalidate the session on the server, clears local authToken and connectionVerified state, and handles errors by forcing local logout.
    // Logout tool
    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.` }]
            };
        }
    });
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the behavioral trait of invalidating tokens and ending sessions, which is essential for a mutation operation. However, it does not mention potential side effects, error conditions, or confirmation of success, leaving some behavioral aspects unclear.

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 a single, efficient sentence with zero waste. It is front-loaded with the core action ('invalidate') and resource, making it easy to understand quickly. Every word contributes directly to the tool's purpose.

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

Completeness3/5

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

For a mutation tool with no annotations and no output schema, the description is minimal but adequate. It states what the tool does but lacks details on outcomes, errors, or dependencies. Given the complexity (simple action, no parameters), it meets minimum viability but could be more informative about behavioral context.

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?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately does not discuss parameters, focusing on the tool's action. A baseline of 4 is applied as it effectively handles the lack of parameters without redundancy.

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 specific action ('invalidate') and resource ('current token and session'), distinguishing it from siblings like 'keep-session-alive' or 'authenticate'. It precisely communicates the tool's function without being tautological.

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

Usage Guidelines4/5

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

The description implies usage context—ending a session when no longer needed—but does not explicitly state when to use it versus alternatives like 'check-connection' or 'keep-session-alive'. It provides clear intent but lacks explicit guidance on exclusions or prerequisites.

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