Skip to main content
Glama
danilat
by danilat

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
NameRequiredDescriptionDefault
stopYes

Implementation Reference

  • 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}`,
            },
          ],
        };
      }
    }
  • 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}`,
              },
            ],
          };
        }
      }
    );

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/danilat/mcp-dndzgz'

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