zaragoza-bus-estimations
Check real-time bus arrival estimates for Zaragoza stops. Enter a stop number to get upcoming bus times.
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)Handler function that fetches real-time bus arrival estimations for a given stop ID from the DNDzgz API and returns the data as JSON 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.{ stop: z.number() },
- index.js:102-126 (registration)Registration of the 'zaragoza-bus-estimations' tool with name, description, input schema, and handler function using server.tool().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}`, }, ], }; } } );