search_stops
Search public transport stops in Berlin-Brandenburg using the Berlin Transport MCP Server. Input a query to find relevant stops and access transport data efficiently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query for stops |
Implementation Reference
- src/index.ts:21-32 (handler)Handler function for 'search_stops' tool: constructs VBB API URL for /locations with query param, fetches data, and returns JSON stringified response.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 for 'search_stops' tool using Zod: requires a 'query' string parameter.{ query: z.string().describe("Search query for stops"), },
- src/index.ts:17-33 (registration)Registration of 'search_stops' tool in the MCP server using this.server.tool, including schema and handler implementation."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) }], }; } );