listar_cargos_municipio
Retrieve contested political positions for a specific municipality in Brazilian elections using election and municipality codes.
Instructions
Lista os cargos em disputa em um município específico
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eleicao | Yes | Código da eleição | |
| municipio | Yes | Código do município |
Implementation Reference
- src/index.ts:301-319 (handler)Handler for the 'listar_cargos_municipio' tool: parses arguments with Zod schema, calls the TSE API to fetch cargos for a specific election and municipality, formats and returns the response.case "listar_cargos_municipio": { const params = CargosMunicipioSchema.parse(args); const data = await handleApiRequest(() => httpClient.get(`/eleicao/listar/municipios/${params.eleicao}/${params.municipio}/cargos`) ); return { content: [ { type: "text", text: `Cargos em disputa no município:\n\n` + `Município: ${data.unidadeEleitoralDTO?.nome || 'N/A'}\n` + `UF: ${data.unidadeEleitoralDTO?.sigla || 'N/A'}\n` + `Cargos disponíveis: ${data.cargos?.length || 0}\n\n` + JSON.stringify(data, null, 2) } ] }; }
- src/index.ts:157-174 (registration)Registration of the 'listar_cargos_municipio' tool in the ListToolsRequestHandler, including name, description, and input schema.{ name: "listar_cargos_municipio", description: "Lista os cargos em disputa em um município específico", inputSchema: { type: "object", properties: { eleicao: { type: "number", description: "Código da eleição" }, municipio: { type: "number", description: "Código do município" } }, required: ["eleicao", "municipio"] } },
- src/index.ts:41-44 (schema)Zod schema used in the handler for validating the input parameters (eleicao and municipio) for the 'listar_cargos_municipio' tool.const CargosMunicipioSchema = z.object({ eleicao: z.number().int(), municipio: z.number().int() });