Skip to main content
Glama

route_optimize_tsp

Optimize the visiting order of waypoints for traveling salesman routes using OSRM. Returns total distance, duration, and visit order; optionally adds route geometry to the project.

Instructions

Optimize the visiting order of waypoints (traveling-salesman-style) via OSRM's trip service.

waypoints is a list of [lat, lon] pairs (>= 3 - below that there's only one order). roundtrip (default True) returns to the start; set False for an open trip ending at the last waypoint. Returns total distance/duration and visit_order (indices into the input waypoints, in visiting order). Pass add_to_project=True to also add the optimized route geometry as a line layer (EPSG:4326).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
profileNocar
base_urlNo
roundtripNo
waypointsYes
layer_nameNo
add_to_projectNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

No annotations provided, so the description fully carries the burden. It discloses behavior: returns total distance/duration and visit_order, optionally adds geometry to project, and mentions the underlying service (OSRM trip service). No contradictions.

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 well-structured with a summary sentence followed by bullet-like details. It uses backticks for code terms and is appropriately sized without excess. Every sentence adds value.

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

Completeness5/5

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

Given the complexity of TSP optimization and optional geometry addition, the description provides sufficient information to use the tool correctly. It covers input, constraints, return values, and optional behavior. An output schema exists (not shown) to define return format.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, requiring the description to explain parameters. It explains waypoints, roundtrip, and add_to_project with specific behavior. It does not cover base_url and layer_name, but these are optional and secondary. Overall adds significant value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool optimizes visiting order of waypoints using TSP via OSRM's trip service. It specifies input format, constraints (>=3 waypoints), and parameters. Distinguishes from sibling routing tools like route_osrm and route_matrix.

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

Usage Guidelines4/5

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

The description provides explicit guidance on when to use the tool (to optimize waypoint order) and important conditions (minimum 3 waypoints, roundtrip option). It does not explicitly mention when not to use or contrast with alternatives, but the context is clear.

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

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/piatkowski/qgis-mcp'

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