Skip to main content
Glama

calculate_route

Read-only

Plan the shortest or safest route between EVE Online solar systems. Input system names or IDs, specify route preferences, and avoid specific systems for optimized navigation.

Instructions

Calculate the shortest route between two EVE Online solar systems using ESI API. Supports system names or IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
avoidSystemsNoOptional array of solar system names (English proper nouns) or IDs to avoid in the route
destinationYesDestination solar system name (English proper noun like 'Amarr') or ID
flagNoRoute preference: shortest (default), secure (high-sec only), or insecure (low/null-sec allowed)shortest
originYesOrigin solar system name (English proper noun like 'Jita') or ID

Implementation Reference

  • The complete implementation of the calculate_route tool, including the execute handler that resolves system names/IDs, calculates route using ESI client, adds system names, and returns structured JSON response.
    export const calculateRouteTool = {
      annotations: {
        openWorldHint: true, // This tool interacts with external ESI API
        readOnlyHint: true, // This tool doesn't modify anything
        title: "Calculate Route",
      },
      description: "Calculate the shortest route between two EVE Online solar systems using ESI API. Supports system names or IDs.",
      execute: async (args: { 
        origin: string | number; 
        destination: string | number; 
        flag?: 'shortest' | 'secure' | 'insecure';
        avoidSystems?: (string | number)[];
      }) => {
        try {
          let originId: number;
          let destinationId: 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`,
                route: null
              });
            }
            originId = originResult[0].id;
          } else {
            originId = args.origin;
          }
    
          // Convert destination to ID if it's a string
          if (typeof args.destination === 'string') {
            const destinationResult = await esiClient.getSolarSystemIds([args.destination]);
            if (destinationResult.length === 0) {
              return JSON.stringify({
                success: false,
                message: `Destination system '${args.destination}' not found`,
                route: null
              });
            }
            destinationId = destinationResult[0].id;
          } else {
            destinationId = args.destination;
          }
    
          // 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);
              }
            }
          }
    
          // Calculate route with details
          const routeInfo = await esiClient.calculateRouteWithDetails(
            originId,
            destinationId,
            args.flag || 'shortest',
            avoidSystemIds
          );
    
          // Get system names for the route
          const routeNames = await esiClient.idsToNames(routeInfo.route);
          const routeWithNames = routeInfo.route.map(systemId => {
            const systemName = routeNames.find(s => s.id === systemId);
            return {
              id: systemId,
              name: systemName?.name || `System ${systemId}`
            };
          });
    
          return JSON.stringify({
            success: true,
            message: `Route calculated: ${routeInfo.jumps} jumps from ${routeInfo.origin.name} to ${routeInfo.destination.name}`,
            route: {
              ...routeInfo,
              route_with_names: routeWithNames,
              summary: {
                total_systems: routeInfo.route.length,
                total_jumps: routeInfo.jumps,
                route_type: routeInfo.flag,
                avoided_systems_count: avoidSystemIds?.length || 0
              }
            }
          });
        } catch (error) {
          return JSON.stringify({
            success: false,
            message: `Error calculating route: ${error instanceof Error ? error.message : 'Unknown error'}`,
            route: null
          });
        }
      },
      name: "calculate_route",
      parameters: z.object({
        origin: z.union([z.string(), z.number()]).describe("Origin solar system name (English proper noun like 'Jita') or ID"),
        destination: z.union([z.string(), z.number()]).describe("Destination solar system name (English proper noun like 'Amarr') or ID"),
        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 the route")
      }),
    };
  • Zod input schema defining parameters for the calculate_route tool.
    parameters: z.object({
      origin: z.union([z.string(), z.number()]).describe("Origin solar system name (English proper noun like 'Jita') or ID"),
      destination: z.union([z.string(), z.number()]).describe("Destination solar system name (English proper noun like 'Amarr') or ID"),
      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 the route")
    }),
  • src/server.ts:18-63 (registration)
    Import of calculateRouteTool from route-tools.js and registration via server.addTool(calculateRouteTool). Also documented in the server info resource.
    import {
      calculateRouteTool,
      calculateMultipleRoutesTool,
      findSystemsInRangeTool
    } from "./route-tools.js";
    import {
      getSystemCombatStatsTool
    } from "./combat-stats-tools.js";
    import {
      getStationServicesTool,
      getSystemStationsTool,
      findStationsWithServicesTool,
      getStationAgentsTool
    } from "./station-services-tools.js";
    import {
      findNearestLandmarksTool
    } from "./landmark-tools.js";
    import {
      findNearestTradeHubTool
    } from "./nearest-trade-hub-tool.js";
    
    const server = new FastMCP({
      name: "EVE Online Traffic MCP",
      version: "1.0.0",
    });
    
    // Add name to ID conversion tools
    server.addTool(solarSystemNameToIdTool);
    server.addTool(stationNameToIdTool);
    server.addTool(regionNameToIdTool);
    server.addTool(universalNameToIdTool);
    
    // Add system information tools
    server.addTool(solarSystemInfoTool);
    server.addTool(stargateInfoTool);
    server.addTool(systemConnectionMapTool);
    
    // Add region information tools
    server.addTool(regionInfoTool);
    server.addTool(constellationInfoTool);
    server.addTool(regionSystemsListTool);
    
    // Add route calculation tools
    server.addTool(calculateRouteTool);
    server.addTool(calculateMultipleRoutesTool);
    server.addTool(findSystemsInRangeTool);
  • Supporting ESI client method called by the tool handler to compute the actual route using EVE Online ESI API /route/ endpoint.
    async calculateRouteWithDetails(
      originId: number,
      destinationId: number,
      flag: 'shortest' | 'secure' | 'insecure' = 'shortest',
      avoidSystems?: number[]
    ): Promise<ESIRouteInfo> {
      try {
        // Get the route
        const route = await this.calculateRoute(originId, destinationId, flag, avoidSystems);
    
        if (route.length === 0) {
          return {
            route: [],
            jumps: -1,
            origin: { id: originId, name: '' },
            destination: { id: destinationId, name: '' },
            flag,
          };
        }
    
        // Get system names for origin and destination
        const systemNames = await this.idsToNames([originId, destinationId]);
        const originName = systemNames.find(s => s.id === originId)?.name || `System ${originId}`;
        const destinationName = systemNames.find(s => s.id === destinationId)?.name || `System ${destinationId}`;
    
        return {
          route,
          jumps: route.length - 1, // Number of jumps is route length minus 1
          origin: {
            id: originId,
            name: originName
          },
          destination: {
            id: destinationId,
            name: destinationName
          },
          flag,
          avoided_systems: avoidSystems
        };
      } catch (error) {
        // If route calculation fails, return a result indicating failure
        return {
          route: [],
          jumps: -1,
          origin: { id: originId, name: '' },
          destination: { id: destinationId, name: '' },
          flag,
        };
      }
    }
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, indicating a safe read operation with flexible inputs. The description adds that it 'Supports system names or IDs' and calculates 'shortest route,' which provides useful context beyond annotations. However, it doesn't mention rate limits, authentication needs, or what happens with invalid inputs.

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 extremely concise with two sentences that efficiently convey core functionality and input support. Every word earns its place, and the information is front-loaded with the primary purpose stated first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a route calculation tool with good annotations (readOnlyHint, openWorldHint) and 100% schema coverage, the description is adequate but minimal. It lacks output format details (no output schema provided), doesn't explain route characteristics beyond 'shortest,' and offers no error handling context.

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%, so parameters are well-documented in the schema. The description adds that it 'Supports system names or IDs,' which clarifies input formats for origin/destination, but doesn't provide additional meaning beyond what the schema already specifies for avoidSystems or flag.

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 tool's purpose: 'Calculate the shortest route between two EVE Online solar systems using ESI API.' It specifies the verb ('calculate'), resource ('route'), and domain ('EVE Online solar systems'), but doesn't explicitly differentiate from sibling tools like 'calculate_multiple_routes' or 'system_connection_map'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'Supports system names or IDs' but doesn't explain when to choose this over sibling tools like 'calculate_multiple_routes' or 'find_nearest_trade_hub', nor does it mention any prerequisites or exclusions.

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-traffic-mcp'

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