Skip to main content
Glama
kongyo2

eve-online-mcp

refresh-token

Renew expired access tokens for EVE Online's MCP server using a valid refresh token, ensuring continued access to real-time market data via the ESI API.

Instructions

Refresh an expired access token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refresh_tokenYesRefresh token from previous authentication

Implementation Reference

  • Handler function for the refresh-token tool. It calls the refreshToken helper with the provided refresh_token, formats the new token data, and returns it as text content. Handles errors by returning an error message.
    async ({ refresh_token }) => {
      try {
        const token = await refreshToken(refresh_token);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                access_token: token.access_token,
                refresh_token: token.refresh_token,
                expires_in: token.expires_in,
                token_type: token.token_type
              }, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Token refresh failed: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ]
        };
      }
    }
  • Zod input schema for the refresh-token tool defining the required refresh_token string parameter.
    {
      refresh_token: z.string().describe("Refresh token from previous authentication")
    },
  • src/index.ts:530-563 (registration)
    Registration of the refresh-token tool on the MCP server using server.tool(). Includes tool name, description, schema, and handler.
    server.tool(
      "refresh-token",
      "Refresh an expired access token",
      {
        refresh_token: z.string().describe("Refresh token from previous authentication")
      },
      async ({ refresh_token }) => {
        try {
          const token = await refreshToken(refresh_token);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  access_token: token.access_token,
                  refresh_token: token.refresh_token,
                  expires_in: token.expires_in,
                  token_type: token.token_type
                }, null, 2)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Token refresh failed: ${error instanceof Error ? error.message : 'Unknown error'}`
              }
            ]
          };
        }
      }
    );
  • Supporting helper function refreshToken that performs the HTTP POST request to EVE Online SSO OAuth endpoint to exchange refresh_token for new access_token and refresh_token.
    async function refreshToken(refresh_token: string): Promise<EveAuthToken> {
      const response = await fetch("https://login.eveonline.com/v2/oauth/token", {
        method: "POST",
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
          "Authorization": `Basic ${Buffer.from(`${EVE_CLIENT_ID}:${EVE_CLIENT_SECRET}`).toString("base64")}`
        },
        body: new URLSearchParams({
          grant_type: "refresh_token",
          refresh_token: refresh_token
        })
      });
    
      if (!response.ok) {
        throw new Error("Failed to refresh token");
      }
    
      const data = await response.json() as EveAuthToken;
      return {
        ...data,
        issued_at: Date.now()
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it indicates this refreshes tokens, it doesn't describe what happens after refresh (e.g., returns new access token, updates session), whether it has rate limits, or what errors might occur. This is a significant gap for a security-related tool.

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 wasted words. It's appropriately sized and front-loaded with the essential information about what the tool does.

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 token refresh operations and the absence of both annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (new access token, expiration time), error conditions, or security implications, leaving critical gaps for agent understanding.

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?

Schema description coverage is 100%, with the single parameter 'refresh_token' well-documented in the schema. The description doesn't add any meaningful parameter semantics beyond what the schema already provides, so it meets the baseline for high schema coverage.

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 ('refresh') and the resource ('an expired access token'), providing a specific verb+resource combination. However, it doesn't distinguish this tool from its sibling 'authenticate' tool, which likely handles initial authentication rather than token renewal.

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?

The description implies usage context through 'expired access token,' suggesting this should be used when tokens expire. However, it doesn't provide explicit guidance on when to use this versus the 'authenticate' sibling tool or mention any prerequisites or alternatives.

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/kongyo2/eve-online-mcp'

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