Skip to main content
Glama
harshil1712

Berlin Transport MCP Server

by harshil1712

get_departures

Retrieve real-time departure information for a specific stop in Berlin's public transport system, including the number of results desired. Powered by the Berlin Transport MCP Server and VBB API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultsNoNumber of results to return
stop_idYesStop ID to get departures for

Implementation Reference

  • Handler function that constructs the VBB API URL for departures at the specified stop, optionally limits results, fetches the data, and returns it as JSON string in MCP content format.
    async ({ stop_id, results }) => { const url = new URL(`/stops/${stop_id}/departures`, VBB_API_BASE); if (results) { url.searchParams.set("results", String(results)); } const response = await fetch(url); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; }
  • Zod input schema defining required 'stop_id' string parameter and optional 'results' number parameter.
    { stop_id: z.string().describe("Stop ID to get departures for"), results: z.number().optional().describe("Number of results to return"), },
  • src/index.ts:37-54 (registration)
    Registration of the 'get_departures' tool on the MCP server using this.server.tool(), including name, input schema, and handler function.
    "get_departures", { stop_id: z.string().describe("Stop ID to get departures for"), results: z.number().optional().describe("Number of results to return"), }, async ({ stop_id, results }) => { const url = new URL(`/stops/${stop_id}/departures`, VBB_API_BASE); if (results) { url.searchParams.set("results", String(results)); } const response = await fetch(url); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } );

Other Tools

Related 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