Skip to main content
Glama

get-market-prices

Retrieve real-time market prices for all items in EVE Online using the EVE Swagger Interface (ESI) API.

Instructions

Get market prices for all items in EVE Online

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the "get-market-prices" tool. It fetches market prices data from the EVE Online ESI API endpoint "/markets/prices/" using the makeESIRequest helper, formats the prices by ensuring non-null values, and returns the data as a formatted JSON string in a text content block.
    async () => { const prices = await makeESIRequest<Array<{ type_id: number; adjusted_price?: number; average_price?: number; }>>("/markets/prices/"); const formattedPrices = prices.map((price) => ({ type_id: price.type_id, adjusted_price: price.adjusted_price || 0, average_price: price.average_price || 0, })); return { content: [ { type: "text", text: JSON.stringify(formattedPrices, null, 2), }, ], }; }
  • src/index.ts:259-285 (registration)
    The server.tool call that registers the "get-market-prices" tool, including its name, description, empty input schema (no parameters), and inline handler function.
    server.tool( "get-market-prices", "Get market prices for all items in EVE Online", {}, async () => { const prices = await makeESIRequest<Array<{ type_id: number; adjusted_price?: number; average_price?: number; }>>("/markets/prices/"); const formattedPrices = prices.map((price) => ({ type_id: price.type_id, adjusted_price: price.adjusted_price || 0, average_price: price.average_price || 0, })); return { content: [ { type: "text", text: JSON.stringify(formattedPrices, null, 2), }, ], }; } );
  • The makeESIRequest helper function used by the handler to perform API requests to the EVE Online ESI endpoints, handling rate limiting, authentication, error handling, and response parsing.
    async function makeESIRequest<T>(endpoint: string, token?: string): Promise<T> { if (!checkRateLimit(endpoint)) { throw new Error("Rate limit exceeded. Please try again later."); } const headers: Record<string, string> = { "User-Agent": USER_AGENT, "Accept": "application/json", }; if (token) { headers["Authorization"] = `Bearer ${token}`; } const response = await fetch(`${ESI_BASE_URL}${endpoint}`, { headers }); updateRateLimit(endpoint, response.headers); if (!response.ok) { let errorMessage = `HTTP error! status: ${response.status}`; try { const errorData = await response.json() as ESIError; if (errorData.error) { errorMessage = `ESI Error: ${errorData.error}`; if (errorData.error_description) { errorMessage += ` - ${errorData.error_description}`; } } } catch { // エラーJSONのパースに失敗した場合は、デフォルトのエラーメッセージを使用 } throw new Error(errorMessage); } return response.json() as Promise<T>; }
  • TypeScript interface defining the structure of market price data returned from the ESI API, matching the types used in the handler.
    interface MarketPrice { adjusted_price?: number; average_price?: number; type_id: number; }

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