nearest
Pack: osrm · Endpoint: https://gateway.pipeworx.io/osrm/mcp
Snap a single point to the nearest road segment.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
longitude | number | yes | |
latitude | number | yes | |
profile | string | no | |
number | number | no | How many alternatives to return (default 1) |
Example call
Arguments
{
"longitude": -122.42,
"latitude": 37.77
}
curl
curl -X POST https://gateway.pipeworx.io/osrm/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"nearest","arguments":{"longitude":-122.42,"latitude":37.77}}}'
TypeScript (@pipeworx/sdk)
import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();
const result = await pipeworx.call('nearest', {
"longitude": -122.42,
"latitude": 37.77
});
More examples
{
"longitude": -122.39,
"latitude": 37.78,
"profile": "car",
"number": 3
}
Response shape
| Field | Type | Description |
|---|---|---|
code | string | Status code (Ok or error) |
waypoints | array | Array of nearest waypoint candidates |
Full JSON Schema
{
"type": "object",
"description": "Nearest road segment response from OSRM",
"properties": {
"code": {
"type": "string",
"description": "Status code (Ok or error)"
},
"waypoints": {
"type": "array",
"description": "Array of nearest waypoint candidates",
"items": {
"type": "object",
"properties": {
"hint": {
"type": "string",
"description": "Hint for snapping"
},
"distance": {
"type": "number",
"description": "Distance to road in meters"
},
"name": {
"type": "string",
"description": "Name of nearest street"
},
"location": {
"type": "array",
"description": "Snapped [lon, lat] coordinates"
}
}
}
}
}
}
Connect
Add this to your MCP client config, or use one-click install buttons:
{
"mcpServers": {
"osrm": {
"url": "https://gateway.pipeworx.io/osrm/mcp"
}
}
}
See Getting Started for client-specific install steps.