Skip to main content
Glama
harshil1712

Berlin Transport MCP Server

by harshil1712

search_stops

Find public transport stops in Berlin-Brandenburg by entering a search query to locate stations, bus stops, and tram stations for journey planning.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for stops

Implementation Reference

  • Handler function that performs a search for transport stops using the VBB API by constructing the API URL with the query parameter and fetching the results.
      async ({ query }) => {
        const url = new URL("/locations", VBB_API_BASE);
        url.searchParams.set("query", query);
        url.searchParams.set("poi", "false");
        url.searchParams.set("addresses", "false");
    
        const response = await fetch(url);
        const data = await response.json();
        return {
          content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
        };
      }
    );
  • Input schema defining the 'query' parameter as a string for the search_stops tool.
    {
      query: z.string().describe("Search query for stops"),
    },
  • src/index.ts:16-34 (registration)
    Registration of the 'search_stops' tool on the MCP server, including name, input schema, and handler function.
    this.server.tool(
      "search_stops",
      {
        query: z.string().describe("Search query for stops"),
      },
      async ({ query }) => {
        const url = new URL("/locations", VBB_API_BASE);
        url.searchParams.set("query", query);
        url.searchParams.set("poi", "false");
        url.searchParams.set("addresses", "false");
    
        const response = await fetch(url);
        const data = await response.json();
        return {
          content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
        };
      }
    );
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/harshil1712/berlin-transport-mcp'

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