Skip to main content
Glama
karnagge

MCP DivulgaCandContas Server

by karnagge

listar_candidatos_municipio

Retrieve candidate lists for municipal elections in Brazil using official TSE data. Specify election year, municipality code, election code, and position code to get comprehensive candidate information.

Instructions

Lista todos os candidatos para eleições em um município específico

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
anoYesAno da eleição (ex: 2020)
municipioYesCódigo do município (ex: 35157 para São Paulo)
eleicaoYesCódigo da eleição (ex: 2030402020 para eleições municipais de 2020)
cargoYesCódigo do cargo

Implementation Reference

  • Handler for the 'listar_candidatos_municipio' tool. Validates input using Zod schema, fetches candidate list from TSE API, and returns formatted JSON response.
    case "listar_candidatos_municipio": {
      const params = CandidatosParaMunicipioSchema.parse(args);
      const data = await handleApiRequest(() => 
        httpClient.get(`/candidatura/listar/${params.ano}/${params.municipio}/${params.eleicao}/${params.cargo}/candidatos`)
      );
      
      return {
        content: [
          {
            type: "text",
            text: `Candidatos encontrados: ${data.candidatos?.length || 0}\n\n` +
                  JSON.stringify(data, null, 2)
          }
        ]
      };
    }
  • Zod schema for validating input parameters of the listar_candidatos_municipio tool.
    const CandidatosParaMunicipioSchema = z.object({
      ano: z.number().int().min(2000).max(new Date().getFullYear()),
      municipio: z.number().int(),
      eleicao: z.number().int(),
      cargo: z.number().int()
    });
  • src/index.ts:92-119 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema for MCP protocol.
    {
      name: "listar_candidatos_municipio",
      description: "Lista todos os candidatos para eleições em um município específico",
      inputSchema: {
        type: "object",
        properties: {
          ano: {
            type: "number",
            description: "Ano da eleição (ex: 2020)",
            minimum: 2000,
            maximum: new Date().getFullYear()
          },
          municipio: {
            type: "number", 
            description: "Código do município (ex: 35157 para São Paulo)"
          },
          eleicao: {
            type: "number",
            description: "Código da eleição (ex: 2030402020 para eleições municipais de 2020)"
          },
          cargo: {
            type: "number",
            description: "Código do cargo"
          }
        },
        required: ["ano", "municipio", "eleicao", "cargo"]
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states it's a list operation, implying read-only behavior, but doesn't mention potential limitations like pagination, rate limits, authentication needs, or what happens with invalid inputs. For a tool with 4 required parameters and no annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without any wasted words. It directly communicates what the tool does in a compact form, earning full marks for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 required parameters, no output schema, no annotations), the description is minimally adequate. It clarifies the scope (municipality-specific candidates) but omits details on return format, error handling, or sibling tool relationships, leaving room for improvement in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with each parameter well-documented in the schema (e.g., 'ano' as election year with examples). The description adds no additional parameter semantics beyond implying filtering by municipality and election context, so it meets the baseline for high schema coverage without compensating value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Lista') and resource ('todos os candidatos') with specific context ('para eleições em um município específico'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'consultar_candidato' or 'listar_cargos_municipio', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'consultar_candidato' (which might fetch individual candidate details) or other list tools. It lacks explicit when/when-not instructions or named alternatives, leaving usage context implied at best.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/karnagge/mcpcand'

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