zaragoza-tram-estimations
Check real-time arrival estimates for Zaragoza tram stations to plan your journey and reduce waiting time.
Instructions
Get the estimation of when arrives to a tram station in Zaragoza in realtime
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| station | Yes |
Implementation Reference
- index.js:19-39 (handler)Handler function that fetches real-time tram arrival estimations for a Zaragoza tram station from an external API and returns the JSON data or an error message.async ({ station }) => { const response = await fetch( `https://dndzgz.herokuapp.com/services/tram/${station}` ); 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 ${station}`, }, ], }; } } );
- index.js:18-18 (schema)Input schema defining the required 'station' parameter as a number, validated with Zod.{ station: z.number() },
- index.js:15-39 (registration)Registration of the 'zaragoza-tram-estimations' tool using McpServer.tool(), including name, description, input schema, and handler function.server.tool( "zaragoza-tram-estimations", "Get the estimation of when arrives to a tram station in Zaragoza in realtime", { station: z.number() }, async ({ station }) => { const response = await fetch( `https://dndzgz.herokuapp.com/services/tram/${station}` ); 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 ${station}`, }, ], }; } } );