listar_eleicoes_suplementares
Retrieve supplementary election data for specific Brazilian states and years from the TSE's official electoral database.
Instructions
Lista eleições suplementares em um estado e ano específicos
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ano | Yes | Ano da eleição (ex: 2020) | |
| uf | Yes | Sigla da unidade federativa (ex: SP, RJ) |
Implementation Reference
- src/index.ts:337-352 (handler)The handler case for 'listar_eleicoes_suplementares' that validates input parameters using Zod schema, makes an HTTP GET request to the API endpoint for supplementary elections in a specific state and year, and returns a formatted text response with the results.case "listar_eleicoes_suplementares": { const params = EleicoesSuplementaresEstadoSchema.parse(args); const data = await handleApiRequest(() => httpClient.get(`/eleicao/suplementares/${params.ano}/${params.uf}`) ); return { content: [ { type: "text", text: `Eleições suplementares em ${params.uf} (${params.ano}): ${data.length}\n\n` + JSON.stringify(data, null, 2) } ] }; }
- src/index.ts:46-49 (schema)Zod schema defining the input parameters for the tool: 'ano' (election year) and 'uf' (state abbreviation). Used for validation in the handler.const EleicoesSuplementaresEstadoSchema = z.object({ ano: z.number().int().min(2000).max(new Date().getFullYear()), uf: z.string().length(2) });
- src/index.ts:184-204 (registration)Tool registration in the ListTools response, including name, description, and input schema metadata that clients use to understand and call the tool.{ name: "listar_eleicoes_suplementares", description: "Lista eleições suplementares em um estado e ano específicos", inputSchema: { type: "object", properties: { ano: { type: "number", description: "Ano da eleição (ex: 2020)", minimum: 2000, maximum: new Date().getFullYear() }, uf: { type: "string", description: "Sigla da unidade federativa (ex: SP, RJ)", pattern: "^[A-Z]{2}$" } }, required: ["ano", "uf"] } },