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
| Name | Required | Description | Default |
|---|---|---|---|
| numeroControlePNCP | No | ||
| orgaoCnpj | No | ||
| ano | No | ||
| sequencial | No |
Implementation Reference
- src/adapters/pncp.ts:341-365 (handler)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; } } - src/schemas/pncp.ts:206-225 (schema)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>;