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.` }] }; } });

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