Skip to main content
Glama

get_token

Fetch and cache authentication tokens for the ZenTao project management system using account credentials to enable API access.

Instructions

Fetch a token via POST /tokens using env ZENTAO_ACCOUNT/PASSWORD. Caches in-memory.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceRefreshNoIgnore cached token

Implementation Reference

  • Handler logic for the 'get_token' tool within the CallToolRequestSchema handler. It calls fetchToken with the optional forceRefresh argument and returns the token as a text content block.
    if (name === "get_token") { const token = await fetchToken(Boolean(args.forceRefresh)); return { content: [ { type: "text", text: `token=${token}`, }, ], };
  • Schema definition for the 'get_token' tool, including name, description, and input schema (with optional forceRefresh boolean). Registered in ListToolsRequestSchema response.
    { name: "get_token", description: "Fetch a token via POST /tokens using env ZENTAO_ACCOUNT/PASSWORD. Caches in-memory.", inputSchema: { type: "object", properties: { forceRefresh: { type: "boolean", description: "Ignore cached token" }, }, required: [], additionalProperties: false, }, },
  • Core helper function that implements the token fetching logic: checks cache, asserts config, POSTs to /tokens endpoint with account/password, parses response, caches and returns the token.
    async function fetchToken(forceRefresh = false) { if (cachedToken && !forceRefresh) return cachedToken; assertConfig(); const url = `${baseUrl}/api.php/v1/tokens`; const res = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ account, password }), }); const text = await res.text(); if (!res.ok) throw new Error(`Token request failed: ${res.status} ${text}`); const data = safeJson(text); if (!data?.token) throw new Error("Token missing in response"); cachedToken = data.token; return cachedToken; }

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/Valiant-Cat/zentao-mcp-server'

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