Skip to main content
Glama
Licinexus

licinexus-mcp

Official
by Licinexus

list_licitacao_arquivos

List all files attached to a Brazilian public procurement (licitação) on PNCP, including PDFs, attachments, and terms of reference, returning metadata and direct URLs without downloading content.

Instructions

List the files (edital PDFs, attachments, terms of reference) attached to a licitação on PNCP. Returns metadata and direct URLs — does not download the file content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
numeroControlePNCPNo
orgaoCnpjNo
anoNo
sequencialNo

Implementation Reference

  • The handler function that executes the tool logic. It parses arguments using PncpIdInputSchema, resolves the PNCP ID, calls listContratacaoArquivos adapter function, and returns the list of files.
      async handler(rawArgs) {
        const parse = PncpIdInputSchema.safeParse(rawArgs ?? {});
        if (!parse.success) {
          return errorResult(`Invalid arguments: ${parse.error.message}`);
        }
        try {
          const { orgaoCnpj, ano, sequencial } = resolvePncpId(parse.data);
          const files = await listContratacaoArquivos(orgaoCnpj, ano, sequencial);
          return jsonResult({
            meta: { orgaoCnpj, ano, sequencial, total: files.length },
            arquivos: files,
          });
        } catch (err) {
          const msg = err instanceof PncpError ? err.message : String(err);
          return errorResult(`Failed to list arquivos: ${msg}`);
        }
      },
    };
  • Input schema for the tool, accepting numeroControlePNCP or orgaoCnpj/ano/sequencial fields.
    inputSchema: {
      type: 'object',
      properties: {
        numeroControlePNCP: { type: 'string' },
        orgaoCnpj: { type: 'string' },
        ano: { type: 'integer' },
        sequencial: { type: 'integer' },
      },
    },
  • ArquivoSchema: Zod schema defining the shape of each file/attachment returned by the API.
    export const ArquivoSchema = z
      .object({
        sequencialDocumento: z.number(),
        titulo: z.string().nullable().optional(),
        tipoDocumentoNome: z.string().nullable().optional(),
        url: z.string().nullable().optional(),
        uri: z.string().nullable().optional(),
        dataPublicacaoPncp: z.string().nullable().optional(),
        cnpj: z.string().nullable().optional(),
        anoCompra: z.number().nullable().optional(),
        sequencialCompra: z.number().nullable().optional(),
      })
      .passthrough();
    
    export type Arquivo = z.infer<typeof ArquivoSchema>;
  • listContratacaoArquivos adapter function that calls the PNCP API endpoint /orgaos/{cnpj}/compras/{ano}/{sequencial}/arquivos and returns parsed Arquivo objects.
    export async function listContratacaoArquivos(
      orgaoCnpj: string,
      ano: number,
      sequencial: number,
    ): Promise<Arquivo[]> {
      const cacheKey = `list:arquivos:${orgaoCnpj}:${ano}:${sequencial}`;
      const cached = cache.get<Arquivo[]>(cacheKey);
      if (cached) return cached;
    
      try {
        const { data } = await withRetry(() =>
          pncpClient.get(`/orgaos/${orgaoCnpj}/compras/${ano}/${sequencial}/arquivos`),
        );
        const arr = asArray(data);
        const parsed = ArquivoSchema.array().parse(arr);
        cache.set(cacheKey, parsed, TTL_30_MIN);
        return parsed;
      } catch (err) {
        if (err instanceof AxiosError) {
          if (err.response?.status === 404) return [];
          throw new PncpError(describeAxiosError(err), err);
        }
        throw err;
      }
    }
  • Registration of listLicitacaoArquivos in the allTools array and dynamically in toolMap.
      listLicitacaoArquivos,
      // Contratos
      searchContratos,
      getContratoTool,
      listContratoTermosTool,
      listContratoInstrumentosTool,
      // Atas RP
      searchAtasRp,
      getAtaRp,
      // Órgãos / Fornecedores
      getOrgaoTool,
      getFornecedorContratos,
      // PCA
      searchPca,
      listPcaItensTool,
      // CNPJ enrichment
      getCnpjDataTool,
      // Análise agregada (v0.2.0)
      aggregateLicitacoes,
      comparePeriodos,
    ];
    
    export const toolMap = new Map<string, ToolDef>(allTools.map((t) => [t.definition.name, t]));
Behavior3/5

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

No annotations are provided, so the description carries full transparency burden. It discloses the tool does not download file content, which is useful, but omits other behavioral details (e.g., rate limits, auth needs, response format).

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?

Two sentences efficiently convey purpose, scope, and a key limitation. No filler; front-loads the verb 'List' and immediately specifies the resource.

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?

For a list tool with 4 parameters and no output schema, the description provides basic functionality and return type but lacks parameter semantics, pagination info, or error handling. It is adequate for simple use but not fully self-sufficient.

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

Parameters2/5

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

Schema coverage is 0% and the description does not explain any parameter meaning or usage. The tool has 4 parameters with no descriptions, and the description only mentions listing files without linking to parameters, leaving the agent to guess how to specify the licitação.

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

Purpose5/5

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

The description clearly states the tool lists files (edital PDFs, attachments, terms of reference) attached to a licitação, returns metadata and direct URLs, and explicitly says it does not download content. This distinguishes it from siblings like list_licitacao_itens.

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

Usage Guidelines3/5

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

No explicit guidance on when to use this tool versus alternatives, nor prerequisites like which parameters are required. The description implies usage for file access but lacks context on tool selection criteria.

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/Licinexus/licinexus-mcp'

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