zaragoza-bus-estimations
Check real-time bus arrival times at specific stops in Zaragoza using the DNDzgz MCP Server API. Simplify your commute by accessing accurate estimations directly.
Instructions
Get the estimation of when a bus arrives to a stop in Zaragoza in realtime
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stop | Yes |
Implementation Reference
- index.js:106-125 (handler)The handler function fetches real-time bus arrival estimations from the API endpoint https://dndzgz.herokuapp.com/services/bus/${stop} and returns the JSON data or an error message.async ({ stop }) => { const response = await fetch( `https://dndzgz.herokuapp.com/services/bus/${stop}` ); if (response.ok) { const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data) }], }; } else { return { content: [ { type: "text", text: `Is not possible to get the estimate for the stop ${stop}`, }, ], }; } }
- index.js:105-105 (schema)Input schema defining the 'stop' parameter as a number using Zod.{ stop: z.number() },
- index.js:102-126 (registration)Registration of the 'zaragoza-bus-estimations' tool using server.tool(), including name, description, schema, and handler.server.tool( "zaragoza-bus-estimations", "Get the estimation of when a bus arrives to a stop in Zaragoza in realtime", { stop: z.number() }, async ({ stop }) => { const response = await fetch( `https://dndzgz.herokuapp.com/services/bus/${stop}` ); if (response.ok) { const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data) }], }; } else { return { content: [ { type: "text", text: `Is not possible to get the estimate for the stop ${stop}`, }, ], }; } } );