Skip to main content
Glama
danilat
by danilat

zaragoza-bus-stops

Find bus stops in Zaragoza by entering coordinates to access public transport locations and plan routes.

Instructions

Get all bus stops in Zaragoza

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latitudeYes
longitudeYes

Implementation Reference

  • index.js:80-99 (handler)
    Handler function that fetches bus stops from the API, computes nearest positions using helpers, and returns formatted content or error message.
    async ({ latitude, longitude }) => {
      const response = await fetch("https://dndzgz.herokuapp.com/services/bus");
      if (response.ok) {
        const data = await response.json();
        const nearestPositions = getTopNearestPositions(
          data.locations,
          latitude,
          longitude
        );
        return {
          content: [{ type: "text", text: JSON.stringify(nearestPositions) }],
        };
      } else {
        return {
          content: [
            { type: "text", text: "It was not possible to get the bus stops" },
          ],
        };
      }
    }
  • Zod schema defining input parameters: latitude and longitude as numbers.
    {
      latitude: z.number(),
      longitude: z.number(),
    },
  • index.js:73-100 (registration)
    Tool registration call using McpServer.tool() with name, description, input schema, and handler function.
    server.tool(
      "zaragoza-bus-stops",
      "Get all bus stops in Zaragoza",
      {
        latitude: z.number(),
        longitude: z.number(),
      },
      async ({ latitude, longitude }) => {
        const response = await fetch("https://dndzgz.herokuapp.com/services/bus");
        if (response.ok) {
          const data = await response.json();
          const nearestPositions = getTopNearestPositions(
            data.locations,
            latitude,
            longitude
          );
          return {
            content: [{ type: "text", text: JSON.stringify(nearestPositions) }],
          };
        } else {
          return {
            content: [
              { type: "text", text: "It was not possible to get the bus stops" },
            ],
          };
        }
      }
    );
  • Helper to retrieve the top N nearest positions from an ordered list (default 10).
    function getTopNearestPositions(positions, latitude, longitude, size = 10) {
      return getOrderedPositionsByDistance(positions, latitude, longitude).slice(
        0,
        size
      );
    }
  • Helper to compute distances using haversine formula and sort positions by distance.
    function getOrderedPositionsByDistance(positions, latitude, longitude) {
      return positions
        .map((position) => {
          const distanceInMeters = haversineDistanceInMeters(
            { lat: latitude, lon: longitude },
            position
          );
          return {
            ...position,
            distanceInMeters,
          };
        })
        .sort((a, b) => a.distanceInMeters - b.distanceInMeters);
    }
  • Haversine formula implementation to calculate distance between two lat/lon positions in meters.
    function haversineDistanceInMeters(position1, position2) {
      const toRadians = (degrees) => degrees * (Math.PI / 180);
    
      const radiusOfEarth = 6371;
      const dLat = toRadians(position2.lat - position1.lat);
      const dLon = toRadians(position2.lon - position1.lon);
    
      const a =
        Math.sin(dLat / 2) * Math.sin(dLat / 2) +
        Math.cos(toRadians(position1.lat)) *
          Math.cos(toRadians(position2.lat)) *
          Math.sin(dLon / 2) *
          Math.sin(dLon / 2);
    
      const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
      return radiusOfEarth * c * 1000;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe how it behaves: whether it returns all stops globally or filtered by proximity, what format the results are in, whether there are rate limits, or any error conditions. This leaves significant gaps for an agent to understand the tool's operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just one sentence with no wasted words. It's front-loaded with the core purpose and uses clear, straightforward language. Every word earns its place in this minimal description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 2 required parameters, 0% schema description coverage, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain the parameter purpose, result format, or behavioral characteristics. The agent would struggle to use this tool effectively without additional context or experimentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage for its two required parameters (latitude, longitude), and the description provides no information about what these parameters mean or how they affect the results. The description says 'Get all bus stops' which seems to contradict the need for location parameters, creating confusion about whether filtering occurs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('all bus stops in Zaragoza'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'zaragoza-bus-estimations' or 'zaragoza-bizi-stations', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention whether it's for general listing, proximity-based queries (implied by latitude/longitude parameters but not stated), or how it differs from other Zaragoza transportation tools like 'zaragoza-bus-estimations' or 'zaragoza-tram-stations'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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