Skip to main content
Glama

get-market-history

Retrieve historical market data for a specific item in a region using the EVE Online API. Input region and item IDs to access detailed trade insights.

Instructions

Get market history for a specific item in a region

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
region_idYesRegion ID to get market history from
type_idYesItem type ID to get history for

Implementation Reference

  • Handler function that fetches market history data from the EVE Online ESI API endpoint `/markets/${region_id}/history/?type_id=${type_id}` using the shared makeESIRequest helper and returns it as a formatted JSON text content block.
    async ({ region_id, type_id }) => { const history = await makeESIRequest<Array<MarketHistory>>(`/markets/${region_id}/history/?type_id=${type_id}`); return { content: [ { type: "text", text: JSON.stringify(history, null, 2), }, ], }; }
  • Zod schema defining the required input parameters: region_id (number) and type_id (number).
    { region_id: z.number().describe("Region ID to get market history from"), type_id: z.number().describe("Item type ID to get history for"), },
  • src/index.ts:323-342 (registration)
    Tool registration via server.tool() call, including name 'get-market-history', description, input schema, and inline handler implementation.
    server.tool( "get-market-history", "Get market history for a specific item in a region", { region_id: z.number().describe("Region ID to get market history from"), type_id: z.number().describe("Item type ID to get history for"), }, async ({ region_id, type_id }) => { const history = await makeESIRequest<Array<MarketHistory>>(`/markets/${region_id}/history/?type_id=${type_id}`); return { content: [ { type: "text", text: JSON.stringify(history, null, 2), }, ], }; } );
  • TypeScript interface defining the structure of market history data items returned by the ESI API.
    interface MarketHistory { average: number; date: string; highest: number; lowest: number; order_count: number; volume: number; }
  • Shared helper function for making authenticated ESI API requests, handling rate limits, errors, and headers. Used by the get-market-history handler.
    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>; }

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