get_stadium
Look up a World Cup stadium's details using its unique slug. Start with list_stadiums to find the correct slug.
Instructions
Single venue details by stable slug ID. Slugs are kebab-case ("estadio-azteca", "maracana", "wembley-stadium-old", "metlife-stadium"). Use list_stadiums first if you need to discover the right ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Stadium slug, e.g. "estadio-azteca" |
Implementation Reference
- src/index.ts:249-249 (handler)The handler for get_stadium: calls api() with /stadiums/{id} path. It receives a slug ID (kebab-case) and fetches venue details from the API.
handler: async (args: { id: string }) => api(`/stadiums/${args.id}`), - src/index.ts:246-248 (schema)The input schema for get_stadium: expects a single string field 'id' (min 2 chars) describing the stadium slug (e.g. 'estadio-azteca'). The schema is strict (no extra fields).
schema: z.object({ id: z.string().min(2).describe('Stadium slug, e.g. "estadio-azteca"'), }).strict(), - src/index.ts:240-250 (registration)The tool registration entry in the 'tools' array. Defines name 'get_stadium', description, schema, and handler. This array is consumed by ListToolsRequestSchema and CallToolRequestSchema handlers.
{ name: 'get_stadium', description: 'Single venue details by stable slug ID. Slugs are kebab-case ("estadio-azteca", ' + '"maracana", "wembley-stadium-old", "metlife-stadium"). Use list_stadiums first if ' + 'you need to discover the right ID.', schema: z.object({ id: z.string().min(2).describe('Stadium slug, e.g. "estadio-azteca"'), }).strict(), handler: async (args: { id: string }) => api(`/stadiums/${args.id}`), }, - src/index.ts:70-91 (helper)The api() helper function that get_stadium's handler delegates to. It constructs the URL, adds auth headers (X-API-Key), fetches data, and returns parsed JSON. Handles errors and missing API key.
async function api<T = unknown>(path: string): Promise<T> { if (!API_KEY) { throw new Error( 'WC_API_KEY is not set in the environment. Get a free key at ' + 'https://api.zafronix.com/signup and add it to your MCP client ' + 'config: { "env": { "WC_API_KEY": "zwc_pk_..." } }', ); } const url = path.startsWith('http') ? path : `${API_BASE}${path}`; const res = await fetch(url, { headers: { 'X-API-Key': API_KEY, 'Accept': 'application/json', 'User-Agent': 'wc-mcp/0.1.2', }, }); if (!res.ok) { const body = await res.text().catch(() => ''); throw new Error(`API ${res.status} ${res.statusText} on ${path}: ${body.slice(0, 240)}`); } return res.json() as Promise<T>; }