calculate_multiple_routes
Plan efficient EVE Online travel by calculating routes from one origin to multiple destinations. Choose optimal paths based on shortest, secure, or insecure preferences, with the option to avoid specific systems.
Instructions
Calculate routes from one origin system to multiple destination systems. Useful for finding the best destination or comparing routes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| avoidSystems | No | Optional array of solar system names (English proper nouns) or IDs to avoid in all routes | |
| destinations | Yes | Array of destination solar system names (English proper nouns) or IDs (max 20) | |
| flag | No | Route preference: shortest (default), secure (high-sec only), or insecure (low/null-sec allowed) | shortest |
| origin | Yes | Origin solar system name (English proper noun like 'Jita') or ID |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"avoidSystems": {
"description": "Optional array of solar system names (English proper nouns) or IDs to avoid in all routes",
"items": {
"type": [
"string",
"number"
]
},
"type": "array"
},
"destinations": {
"description": "Array of destination solar system names (English proper nouns) or IDs (max 20)",
"items": {
"type": [
"string",
"number"
]
},
"maxItems": 20,
"minItems": 1,
"type": "array"
},
"flag": {
"default": "shortest",
"description": "Route preference: shortest (default), secure (high-sec only), or insecure (low/null-sec allowed)",
"enum": [
"shortest",
"secure",
"insecure"
],
"type": "string"
},
"origin": {
"description": "Origin solar system name (English proper noun like 'Jita') or ID",
"type": [
"string",
"number"
]
}
},
"required": [
"origin",
"destinations"
],
"type": "object"
}
Implementation Reference
- src/route-tools.ts:135-259 (handler)The main handler function 'execute' that implements the tool logic: converts system names/IDs, calculates routes to multiple destinations using ESI API, sorts by jump count, and returns detailed results with summaries and errors.execute: async (args: { origin: string | number; destinations: (string | number)[]; flag?: 'shortest' | 'secure' | 'insecure'; avoidSystems?: (string | number)[]; }) => { try { if (args.destinations.length === 0) { return JSON.stringify({ success: false, message: "At least one destination must be provided", routes: [] }); } if (args.destinations.length > 20) { return JSON.stringify({ success: false, message: "Maximum 20 destinations allowed per request", routes: [] }); } let originId: number; let avoidSystemIds: number[] | undefined; // Convert origin to ID if it's a string if (typeof args.origin === 'string') { const originResult = await esiClient.getSolarSystemIds([args.origin]); if (originResult.length === 0) { return JSON.stringify({ success: false, message: `Origin system '${args.origin}' not found`, routes: [] }); } originId = originResult[0].id; } else { originId = args.origin; } // Convert avoid systems to IDs if provided if (args.avoidSystems && args.avoidSystems.length > 0) { avoidSystemIds = []; for (const system of args.avoidSystems) { if (typeof system === 'string') { const avoidResult = await esiClient.getSolarSystemIds([system]); if (avoidResult.length > 0) { avoidSystemIds.push(avoidResult[0].id); } } else { avoidSystemIds.push(system); } } } const routes = []; const errors = []; // Calculate routes to each destination for (const destination of args.destinations) { try { let destinationId: number; // Convert destination to ID if it's a string if (typeof destination === 'string') { const destinationResult = await esiClient.getSolarSystemIds([destination]); if (destinationResult.length === 0) { errors.push(`Destination system '${destination}' not found`); continue; } destinationId = destinationResult[0].id; } else { destinationId = destination; } // Calculate route const routeInfo = await esiClient.calculateRouteWithDetails( originId, destinationId, args.flag || 'shortest', avoidSystemIds ); routes.push({ destination: routeInfo.destination, jumps: routeInfo.jumps, route_length: routeInfo.route.length, route_type: routeInfo.flag }); } catch (error) { errors.push(`Error calculating route to ${destination}: ${error instanceof Error ? error.message : 'Unknown error'}`); } } // Sort routes by jump count (shortest first) routes.sort((a, b) => a.jumps - b.jumps); return JSON.stringify({ success: routes.length > 0, message: `Calculated ${routes.length} route(s) from ${typeof args.origin === 'string' ? args.origin : `System ${args.origin}`}`, routes, errors: errors.length > 0 ? errors : undefined, summary: { total_destinations_requested: args.destinations.length, successful_routes: routes.length, failed_routes: errors.length, shortest_route: routes.length > 0 ? { destination: routes[0].destination.name, jumps: routes[0].jumps } : null, longest_route: routes.length > 0 ? { destination: routes[routes.length - 1].destination.name, jumps: routes[routes.length - 1].jumps } : null } }); } catch (error) { return JSON.stringify({ success: false, message: `Error calculating multiple routes: ${error instanceof Error ? error.message : 'Unknown error'}`, routes: [] }); } },
- src/route-tools.ts:261-266 (schema)Zod schema defining the input parameters, including origin, destinations array (1-20), optional flag and avoidSystems.parameters: z.object({ origin: z.union([z.string(), z.number()]).describe("Origin solar system name (English proper noun like 'Jita') or ID"), destinations: z.array(z.union([z.string(), z.number()])).min(1).max(20).describe("Array of destination solar system names (English proper nouns) or IDs (max 20)"), flag: z.enum(['shortest', 'secure', 'insecure']).optional().default('shortest').describe("Route preference: shortest (default), secure (high-sec only), or insecure (low/null-sec allowed)"), avoidSystems: z.array(z.union([z.string(), z.number()])).optional().describe("Optional array of solar system names (English proper nouns) or IDs to avoid in all routes") }),
- src/server.ts:62-62 (registration)Registration of the tool in the FastMCP server by adding it via server.addTool.server.addTool(calculateMultipleRoutesTool);
- src/server.ts:19-22 (registration)Import of the calculateMultipleRoutesTool from route-tools.js for use in the server.calculateRouteTool, calculateMultipleRoutesTool, findSystemsInRangeTool } from "./route-tools.js";