get_market_stats
Retrieve market price and volume statistics for specific EVE Online item types in defined regions using regionId and typeId inputs.
Instructions
Returns price and volume stats for an item type in a specific region
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| locationId | No | Location ID (station, structure) to filter on | |
| regionId | Yes | Region ID | |
| systemId | No | System ID to filter on | |
| typeId | Yes | Item type ID |
Implementation Reference
- src/server.ts:31-48 (handler)The main handler function that constructs the API endpoint based on parameters and fetches market stats using the makeApiRequest helper.execute: async (args) => { let endpoint = `/v1/market/stats/${args.regionId}/${args.typeId}`; const params = new URLSearchParams(); if (args.systemId) { params.append('systemId', args.systemId.toString()); } if (args.locationId) { params.append('locationId', args.locationId.toString()); } if (params.toString()) { endpoint += `?${params.toString()}`; } const data = await makeApiRequest(endpoint); return JSON.stringify(data, null, 2); },
- src/server.ts:50-55 (schema)Zod schema defining the input parameters for the get_market_stats tool.parameters: z.object({ regionId: z.number().describe("Region ID"), typeId: z.number().describe("Item type ID"), systemId: z.number().optional().describe("System ID to filter on"), locationId: z.number().optional().describe("Location ID (station, structure) to filter on"), }),
- src/server.ts:24-56 (registration)The server.addTool call that registers the get_market_stats tool with FastMCP, including name, description, handler, and schema.server.addTool({ annotations: { openWorldHint: true, readOnlyHint: true, title: "Get Market Stats", }, description: "Returns price and volume stats for an item type in a specific region", execute: async (args) => { let endpoint = `/v1/market/stats/${args.regionId}/${args.typeId}`; const params = new URLSearchParams(); if (args.systemId) { params.append('systemId', args.systemId.toString()); } if (args.locationId) { params.append('locationId', args.locationId.toString()); } if (params.toString()) { endpoint += `?${params.toString()}`; } const data = await makeApiRequest(endpoint); return JSON.stringify(data, null, 2); }, name: "get_market_stats", parameters: z.object({ regionId: z.number().describe("Region ID"), typeId: z.number().describe("Item type ID"), systemId: z.number().optional().describe("System ID to filter on"), locationId: z.number().optional().describe("Location ID (station, structure) to filter on"), }), });
- src/server.ts:12-21 (helper)Shared helper function used by get_market_stats (and other tools) to make API requests to the EVE Tycoon API.async function makeApiRequest(endpoint: string): Promise<any> { const url = `${BASE_URL}${endpoint}`; const response = await fetch(url); if (!response.ok) { throw new Error(`API request failed: ${response.status} ${response.statusText}`); } return response.json(); }