comexscope

v0.1.0
io.github.CloudCorpRecords/comexscope Checked 2 days ago Published 18 days ago

Brazil foreign-trade data by HS code: exports, imports, partners, balances, climate, reports.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

kyrodata_compare_trade Compare exports/imports between equal windows

Compares Brazil's exports or imports between two equal-length windows (like-for-like), in value (USD FOB) and in volume (kg). `mode` changes the reading: quarterly, semestral, annual, ytd and rolling_3m/6m/12m look a year back and hold the season constant, while monthly and semestral_sequential compare against the period immediately before and cross one. `codes` and `countryIds` filter both windows alike and combine: together they isolate one product to one partner (1201 soybean to 160 China); omitted, every product and partner counts. The result carries both windows, the % change of each metr…

ParameterTypeDescription
flow *stringDirection of the trade flow, from Brazil’s side: `export` leaves the country, `import` enters it.
mode *stringWhich pair of equal-length windows to compare. Against the same period a year earlier: `quarterly`, `semestral`, `annual`, `ytd` (January to the last published month) and `rolling_3m`/`6m`/`12m`. Agai…
codesarrayProducts to filter by, as HS codes — 4 digits (heading), 6 (subheading) or 8 (Brazilian NCM), up to 10. Omit for every product. kyrodata_resolve_entity turns a product name into its code.
countryIdsarrayPartner countries to filter by, as ids from kyrodata_resolve_entity. Omit for every partner.
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.

kyrodata_explain_pyramid_level Explain one level of the forecast pyramid

Explains the pyramid's arithmetic for one commodity and horizon: the seven levels side by side (label, push %, weight share, confidence, contribution %) and, for the levels that did not enter, the reason with its ruler (hit rate vs base rate, number of origins). `horizon` fixes the month and shows the seven levels; `levelKey` flips the cut, following one level across all four horizons instead. This is the drill-down of kyrodata_get_hub_summary — the 'por quê?' behind a verdict that tool already gave. A question about the physical harvest rather than the arithmetic belongs to kyrodata_get_cl…

ParameterTypeDescription
horizon *stringHow far ahead the forecast looks: 1, 3, 6 or 12 months from the last published month.
hub *stringWhich commodity hub to read.
levelKeystringOne level of the pyramid. Given, the answer follows that level across all four horizons instead of showing the seven side by side.
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.

kyrodata_fetch Open one public trade document by id

Opens ONE public foreign-trade document by id and returns it as prose to quote: title, body text and a public URL for citation. `id` is not free text — it is an id kyrodata_search returned, shaped `heading:1201` (an HS heading) or `country:160` (a partner country); anything else is refused rather than guessed. The body carries the measured figures of the latest published year, Brazilian exports and imports in USD FOB and kg, plus the window, the source and its caveats. Public government trade data only. The output here is a citable DOCUMENT with a URL, and this is the only tool that returns…

ParameterTypeDescription
id *stringIdentifier of a document returned by kyrodata_search. Not a free-text query.
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.

kyrodata_get_climate_reading Climate reading and physical crop loss

Current climate reading for a commodity: risk level, the measured production shock in % of the harvest, and the projected physical loss in tonnes per horizon (1, 3, 6 and 12 months) with its range. `scope` sets the geographic cut — 'br' (the default) reads the country, 'region:SE' a macro-region (N, NE, CW, SE, S), 'uf:MG' a single state — and moves only the risk level and the shock: the loss in tonnes stays national at any scope. A commodity without a validated model returns a descriptive reading with no verdict, and a season not yet measurable returns the previous one, each flagged in th…

ParameterTypeDescription
hub *stringWhich commodity hub to read. Climate forecasts PRODUCTION, never price.
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.
scopestringGeographic cut: `br` for the whole country, `region:<N|NE|CW|SE|S>` for a macro-region, or `uf:<XX>` for a state. Defaults to the country.

kyrodata_get_credit_balance Credit balance and limits for this key

Reports the credit balance and the limits of the API key making the request: credits left in the current cycle and when it resets, the daily credit and daily call ceilings of the key, and which tools the key reaches. `response_format` is the only input and it changes verbosity, not scope — there is no argument that selects another key, since the answer describes whichever key authenticated this call. It reads no market data, so it answers a question about the ACCOUNT, never about trade, climate or a commodity. A question about how far the data itself goes is kyrodata_get_data_coverage. Credi…

ParameterTypeDescription
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.

kyrodata_get_data_coverage Data coverage and latest closed month

Returns the calendar of the trade data: first and last published month (YYYYMM), whether the current year is partial, the last fully closed month, and when the aggregates were last refreshed. `response_format` is the only input; the answer covers the whole dataset, so there is no window or product to narrow it with. This answers 'até quando tem dado?' and 'qual o último mês?' — the CALENDAR, never figures. Turning that calendar into a like-for-like window is kyrodata_resolve_comparison_window; reading the figures inside it is kyrodata_get_heading_overview. Credit class: free (0 credits).

ParameterTypeDescription
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.

kyrodata_get_heading_overview Overview of an HS heading (SH4)

Structured read of ONE HS heading (SH4, 4 digits) for exports or imports: totals of the published year (USD FOB, kg), the last closed month against the previous one (average price per kg and volume), and a monthly price-by-volume series. `year` centres the overview and defaults to the most recent published year, with coverage starting in 2000; `months` sets only how far the series reaches back from the last published month, and leaves the totals untouched. A caveat states that US$/kg is an average unit value, not a quoted price. Public data. The output here is FIGURES and a series to reason ov…

ParameterTypeDescription
flow *stringDirection of the trade flow, from Brazil’s side: `export` leaves the country, `import` enters it.
sh4 *stringThe 4-digit HS heading to describe.
monthsintegerLength of the monthly series returned, counting back from the last published month.
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.
yearintegerCalendar year of the TOTALS (USD FOB, kg). Omit for the most recent published year; coverage starts in 2000. The month-over-month figures and the price-by-volume series always describe the latest publ…

kyrodata_get_hub_summary Commodity hub summary and forecast verdict

Reads the Kyrodata pyramid verdict for a commodity hub: direction of the leading horizon, expected move in % per horizon (1, 3, 6 and 12 months), the 80% band as a half-width in percentage points, which levels drive the verdict and the measured accuracy. A horizon without an arrow names the reason, and an empty one means no level passed the confidence gate: no signal, not a stable price. `horizon` re-centres the verdict on the month given; omitted, it centres on the horizon the model leads with, and all four come back either way. It also carries the month-over-month and year-over-year % change…

ParameterTypeDescription
hub *stringWhich commodity hub to read.
horizonstringHow far ahead the forecast looks: 1, 3, 6 or 12 months from the last published month. Omitted, the verdict centres on the horizon the model leads with; given, it re-centres on that one — either way…
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.

kyrodata_get_supply_demand_balance Supply and demand balance sheet

Published supply and demand balance (physical, in tonnes) for one agricultural hub, season by season: production, imports, exports, consumption, initial and final stock, whether the season is still an estimate, and how many months a partial season measures. `hub` accepts only the hubs that have a published balance sheet, which is fewer than the hubs the forecast tools cover; `closedOnly` drops the current season, which is a projection and still moves. The source is a Brazilian government body and is named in the result. This is the physical BALANCE of a season. The price verdict for the same h…

ParameterTypeDescription
hub *stringWhich commodity hub to read. Only hubs with a published balance sheet appear here.
closedOnlybooleanRestrict to seasons already closed. The current season is a projection and still moves.
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.

kyrodata_list_trade_partners Top partner countries with growth

Ranks Brazil's partner countries for exports or imports, one row per country with value (USD FOB), volume (kg), price per kg and share of the window. `from`/`to` are YYYYMM and default to the last 12 published months; `codes` narrows to HS codes (4, 6 or 8 digits) so the ranking answers 'who buys THIS product'; `withGrowth` adds the last 12 months against the previous 12, which is the only way growth enters the answer. The country is the OUTPUT of this tool, so it takes no country filter — a question about one known country is a filter on kyrodata_compare_trade or kyrodata_list_trade_series…

ParameterTypeDescription
flow *stringDirection of the trade flow, from Brazil’s side: `export` leaves the country, `import` enters it.
codesarrayProducts to filter by, as HS codes — 4 digits (heading), 6 (subheading) or 8 (Brazilian NCM), up to 10. Omit for every product. kyrodata_resolve_entity turns a product name into its code.
fromintegerFirst month of the window, as YYYYMM (200403 = March 2004). Omit for the last twelve published months.
limitintegerHow many partner countries to return, largest first by value.
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.
tointegerLast month of the window, as YYYYMM. Omit for the last published month.
withGrowthbooleanAlso return each partner’s growth: the twelve months ending at `to` against the twelve before them. It does NOT follow `from` — with a window of any other length, the ranking and the growth descri…

kyrodata_list_trade_series Raw monthly trade series as rows

Returns Brazil's monthly export or import series as rows — one row per month, with value (USD FOB), volume (kg) and the implied price per kg. `from`/`to` are YYYYMM and default to the last 24 published months; the span is capped at 200 months and a wider one is refused rather than silently truncated. A month with nothing published is ABSENT from the series rather than present as zero, so gaps stay visible instead of reading as collapse. `codes` and `countryIds` narrow the same series and can combine, which is how a single product-and-partner line is drawn. This hands over the POINTS. A quest…

ParameterTypeDescription
flow *stringDirection of the trade flow, from Brazil’s side: `export` leaves the country, `import` enters it.
codesarrayProducts to filter by, as HS codes — 4 digits (heading), 6 (subheading) or 8 (Brazilian NCM), up to 10. Omit for every product. kyrodata_resolve_entity turns a product name into its code.
countryIdsarrayPartner countries to filter by, as ids from kyrodata_resolve_entity. Omit for every partner.
fromintegerFirst month of the window, as YYYYMM (200403 = March 2004). Omit for the last twenty-four published months.
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.
tointegerLast month of the window, as YYYYMM. Omit for the last published month.

kyrodata_resolve_comparison_window Build a like-for-like comparison window

Resolves an equal-length comparison window (like-for-like) for the trade data, anchored on the last fully published month, and returns ONLY the window metadata — from, to, label, months and whether it crosses a season. No figures. `mode` splits into two families, and the split is what matters: quarterly, semestral, annual, ytd and rolling_3m/6m/12m compare against the same period a year earlier and hold the season constant, while monthly and semestral_sequential compare against the period immediately before and therefore cross one. `ytd` runs January to the last published month, in both year…

ParameterTypeDescription
mode *stringWhich pair of equal-length windows to compare. Against the same period a year earlier: `quarterly`, `semestral`, `annual`, `ytd` (January to the last published month) and `rolling_3m`/`6m`/`12m`. Agai…
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.

kyrodata_resolve_entity Resolve country, HS code or commodity

Resolves a free-text name into platform identifiers for FILTERING other tools: commodity hubs (slug plus anchor SH4), HS headings (SH4), NCM codes (8 digits) and partner countries (country id). 'soja' resolves to the soybean hub and SH4 1201; 'China' to country id 160. `query` takes a name already known rather than a topic to explore, and up to 10 matches per kind come back — an ambiguous term returns the candidates instead of one guess, so the caller picks. The output is an ID to pass to another tool, and it carries no document and no URL. Finding what exists in the public catalog, and gett…

ParameterTypeDescription
q *stringWhat to look up, in plain words: a country, a product, or a code. Portuguese and English both work.
kindsarrayNarrow the search to these kinds of entity. Omit to search all of them.
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.

kyrodata_run_report Run one of the catalog reports

Runs one of the product's pre-built catalogue reports by id and returns its rows, up to 50. `reportId` is an enum of the catalogue's ids, so the whole catalogue travels in this schema and no lookup call is needed; `params` carries the values the chosen report declares, and `columnIds` narrows the projection — omitted, the report's default columns come back, and the columns that identify each row are included either way. Columns locked behind a paid plan are declared, with a header stating what an upgrade unlocks, while their values stay out. Rows count against the account's export quota. Thi…

ParameterTypeDescription
reportId *stringWhich catalogue report to run, by id. Each report declares its own parameters, which go in `params`.
columnIdsarrayOnly these columns, by id. Omit for the report’s default set; the columns that identify a row are always returned.
limitintegerMaximum rows to return.
paramsobjectValues for the parameters the chosen report declares.
response_formatstringHow much of the answer to return. `concise` (the default) carries the headline figures; `detailed` adds the row-level series behind them and counts against the export quota.