Skip to main content
Glama

Stadia Maps Location API MCP Server

staticMaps.test.ts1.73 kB
import { describe, it, expect, beforeEach } from "vitest"; import { staticMap, type StaticMapParams } from "./staticMaps.js"; import { server } from "../test/setup.js"; import { http, HttpResponse } from "msw"; import { staticMapFixture } from "../test/fixtures/staticMap.js"; describe("Static Maps Tools", () => { describe("staticMap", () => { it("should generate a static map with a route", async () => { const params: StaticMapParams = { encodedPolyline: "u{~vFvyys@fS]", strokeColor: "blue", strokeWidth: 5, }; const result = await staticMap(params); expect(result).toBeDefined(); expect(result.content).toBeDefined(); expect(result.content[0]).toHaveProperty("type", "image"); expect(result.content[0]).toHaveProperty("data"); expect(result.content[0]).toHaveProperty("mimeType", "image/png"); }); }); describe("Error handling", () => { it("should handle API errors gracefully", async () => { // Override the default handler for this test to return an error server.use( http.post("https://tiles.stadiamaps.com/static_cacheable/*", () => { return HttpResponse.json( { error: "Invalid request parameters" }, { status: 400 }, ); }), ); const params: StaticMapParams = { markers: [ { lat: 37.7749, lon: -122.4194, }, ], }; const result = await staticMap(params); expect(result).toBeDefined(); expect(result.content[0]).toHaveProperty("type", "text"); expect(result.content[0].text).toContain( "Failed to generate static map:", ); }); }); });

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/stadiamaps/stadiamaps-mcp-server-ts'

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