Skip to main content
Glama
Licinexus

licinexus-mcp

Official
by Licinexus

list_contrato_termos

Retrieve additive terms of a contract including extensions, value adjustments, and term changes to understand its evolution.

Instructions

List the additive terms (termos aditivos) of a contract — extensions, value increases/reductions, term changes. Useful to understand contract evolution.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
numeroControlePNCPNo
orgaoCnpjNo
anoNo
sequencialNo

Implementation Reference

  • ToolDef for list_contrato_termos: defines the MCP tool with input schema (numeroControlePNCP, orgaoCnpj, ano, sequencial) and handler that resolves the PNCP ID, calls the adapter, and returns the list of additive terms.
    export const listContratoTermosTool: ToolDef = {
      definition: {
        name: 'list_contrato_termos',
        description:
          'List the additive terms (termos aditivos) of a contract — extensions, value increases/reductions, term changes. Useful to understand contract evolution.',
        inputSchema: {
          type: 'object',
          properties: {
            numeroControlePNCP: { type: 'string' },
            orgaoCnpj: { type: 'string' },
            ano: { type: 'integer' },
            sequencial: { type: 'integer' },
          },
        },
      },
    
      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 termos = await listContratoTermos(orgaoCnpj, ano, sequencial);
          return jsonResult({
            meta: { orgaoCnpj, ano, sequencial, total: termos.length },
            termos,
          });
        } catch (err) {
          const msg = err instanceof PncpError ? err.message : String(err);
          return errorResult(`Failed to list termos: ${msg}`);
        }
      },
    };
  • Core adapter function listContratoTermos: fetches additive terms from PNCP API endpoint /orgaos/{cnpj}/contratos/{ano}/{sequencial}/termos, validates with Zod schema, caches for 30 min TTL, returns empty array on 404.
    export async function listContratoTermos(
      orgaoCnpj: string,
      ano: number,
      sequencial: number,
    ): Promise<TermoContrato[]> {
      const cacheKey = `list:termos:${orgaoCnpj}:${ano}:${sequencial}`;
      const cached = cache.get<TermoContrato[]>(cacheKey);
      if (cached) return cached;
    
      try {
        const { data } = await withRetry(() =>
          pncpClient.get(`/orgaos/${orgaoCnpj}/contratos/${ano}/${sequencial}/termos`),
        );
        const arr = asArray(data);
        const parsed = TermoContratoSchema.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;
      }
    }
  • Zod schema TermoContratoSchema defining the shape of each term (sequencialTermo, tipoTermoContratoNome, valorAcrescimo, valorReducao, prazoAcrescimoDias, novaDataVigenciaFim, etc.) and the inferred TermoContrato type.
    export const TermoContratoSchema = z
      .object({
        numeroControlePNCPContrato: z.string().nullable().optional(),
        sequencialTermo: z.number().nullable().optional(),
        tipoTermoContratoId: z.number().nullable().optional(),
        tipoTermoContratoNome: z.string().nullable().optional(),
        numeroTermoContrato: z.string().nullable().optional(),
        dataAssinatura: z.string().nullable().optional(),
        dataPublicacaoPncp: z.string().nullable().optional(),
        fundamentoLegal: z.string().nullable().optional(),
        informacaoComplementar: z.string().nullable().optional(),
        valorAcrescimo: z.number().nullable().optional(),
        valorReducao: z.number().nullable().optional(),
        prazoAcrescimoDias: z.number().nullable().optional(),
        prazoReducaoDias: z.number().nullable().optional(),
        novaDataVigenciaFim: z.string().nullable().optional(),
      })
      .passthrough();
    
    export type TermoContrato = z.infer<typeof TermoContratoSchema>;
  • Import and registration of listContratoTermosTool in the allTools array (line 31) and toolMap (line 49), making it available to the MCP server.
    import { listContratoTermosTool } from './list_contrato_termos.js';
    import { listContratoInstrumentosTool } from './list_contrato_instrumentos.js';
    import { searchAtasRp } from './search_atas_rp.js';
    import { getAtaRp } from './get_ata_rp.js';
    import { getOrgaoTool } from './get_orgao.js';
    import { getFornecedorContratos } from './get_fornecedor_contratos.js';
    import { searchPca } from './search_pca.js';
    import { listPcaItensTool } from './list_pca_itens.js';
    import { getCnpjDataTool } from './get_cnpj_data.js';
    import { aggregateLicitacoes } from './aggregate_licitacoes.js';
    import { comparePeriodos } from './compare_periodos.js';
    
    export const allTools: ToolDef[] = [
      // Compras / Licitações
      searchLicitacoes,
      getLicitacao,
      listLicitacaoItens,
      listLicitacaoResultados,
      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]));
Behavior2/5

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

With no annotations, the description must fully convey behavioral traits. It only states it lists additive terms, but fails to disclose aspects like ordering, pagination, authentication needs, or behavior when no terms exist. The verb 'list' implies a read operation, but no further context is provided.

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 extremely concise with two sentences: the first stating the core action and examples, the second giving usage context. No redundant information, every sentence earns its place.

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

Completeness2/5

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

Given no annotations, no output schema, and 0% schema description coverage, the description is insufficiently complete. It fails to specify expected response format, pagination, or error handling, leaving the agent without critical context for using the tool correctly.

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

Parameters1/5

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

Input schema has 0% description coverage, and the description adds no information about any of the 4 parameters. Parameter names are self-evident but the description does not clarify their roles or relationships, leaving the AI agent to infer their meaning.

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 additive terms (termos aditivos) of a contract and gives concrete examples (extensions, value changes, term changes). It distinguishes well from siblings like 'get_contrato' and 'list_contrato_instrumentos' by specifying 'additive terms'.

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?

The description includes 'Useful to understand contract evolution,' which implies when to use it, but does not provide explicit guidance on when not to use it or mention any alternative tools. Usage context is implied, not explicitly stated.

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