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
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for stops |
Implementation Reference
- src/index.ts:21-33 (handler)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) }], }; } );
- src/index.ts:18-20 (schema)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) }], }; } );