government
Retrieve fiscal metrics by country—debt, deficit, expenditure, revenue, tax, interest, COFOG spending and public trust—to compare public finances over time.
Instructions
Government fiscal metrics by country (debt, deficit, expenditure, revenue, tax revenue, interest expenditure, expenditure by function, trust in government). Requires countries='United States' — use comma-separated values for multiple countries. Do NOT use tickers= for this tool. Supports start_date/end_date. Debt, deficit, expenditure, revenue and tax revenue are yearly (Global Macro Database, millions of national currency); level='consolidated' (default, longest history), 'general' (general government) or 'central' (central government) selects their level of government. Interest expenditure (IMF, general government interest payable, accrual basis, before interest received; around 40 economies incl. the United States, the euro area countries, the United Kingdom, Canada, Australia and Brazil, not Japan or China) comes quarterly unless period='yearly': get_government_interest_expenditure in millions of national currency, get_government_interest_expenditure_to_gdp_ratio and get_government_interest_expenditure_to_revenue_ratio as decimals, quarterly ratios over the last four quarters. Expenditure by function (IMF COFOG, general government, yearly, around 180 countries, latest year usually one or two years back): get_government_expenditure_by_function (millions of national currency) and get_government_expenditure_by_function_to_gdp_ratio (decimals), columns per country and function; functions= picks 'General Public Services', 'Defence', 'Public Order and Safety', 'Economic Affairs', 'Environmental Protection', 'Housing and Community Amenities', 'Health', 'Recreation, Culture and Religion', 'Education', 'Social Protection' (the ten divisions, the default), 'Public Debt Transactions' (COFOG 01.7, mostly interest, also for countries without interest expenditure) or 'Total', comma-separated. Interest against defence, both shares of the same GDP: get_government_interest_expenditure_to_gdp_ratio with period='yearly' next to get_government_expenditure_by_function_to_gdp_ratio with functions='Defence'. Ratios are decimal fractions (0.04 is 4% of GDP). Supports rolling=N (moving-average smoothing) and trailing=N (trailing N-period sum, e.g. a trailing-4-quarter sum) on the raw series.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"indicator": "<indicator>"
},
"name": "government"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lag | No | Number of periods to lag when computing growth rates. | |
| rank | No | true ranks the tickers (or countries) within every period, from the highest value (rank 1) to the lowest, and compares each with its neighbour toward the middle of the ranking: the Difference (in points for returns) and the Multiple (only when both have the same sign), so the first and last rank show how far the best and the worst stand apart, e.g. a fall more than twice as large as the next one. Needs a value per period and ticker; pick one field with show_columns where there are more. | |
| level | No | Level of government: 'consolidated' (longest history), 'general' (central, state and local government and social security) or 'central'. | consolidated |
| limit | No | The rows to return, like head and tail: 5 for the first five, -5 for the last five (the most recent of a time series). A table with its periods as columns (financial statements, ratios) keeps its first or last periods instead, and rows per ticker (an earnings calendar) are selected per ticker. For ETF holdings the largest (or, negative, the smallest) by weight, and for a list (e.g. news or a screener) its length. 0 returns every row. | |
| growth | No | Return period-over-period growth rates instead of absolute values. | |
| period | No | Observation frequency, e.g. 'daily', 'weekly', 'monthly', 'quarterly', or 'annual' (supported values differ per method). | |
| rolling | No | Rolling window size in number of periods. When set, the metric is computed over a smoothly overlapping trailing window across the full history (e.g. period='monthly' and rolling=6 gives a rolling 6-month value) instead of one value per period, or (for economics indicators) a simple moving average used to smooth the raw series. | |
| end_date | No | End of the date range in YYYY-MM-DD format; left empty, today (or the indicator's own window). | |
| trailing | No | Trailing window size in number of periods. Sums the raw values over the trailing N periods (e.g. trailing=4 on quarterly data gives a trailing-4-quarter / TTM-style sum) instead of returning one value per period. | |
| countries | No | Country names, comma-separated or as a list, e.g. 'United States,Germany,Japan'. | |
| functions | No | Functions of government (COFOG), comma-separated, e.g. 'Defence,Health,Education'; 'Public Debt Transactions' or 'Total' also work. Defaults to the ten divisions. | |
| indicator | Yes | Name of the specific metric to calculate, one of the listed values. Required — search_metrics finds the indicator (and its tool) for a metric by name. | |
| quarterly | No | Return quarterly data instead of annual when True. | |
| start_date | No | Start of the date range in YYYY-MM-DD format; left empty, five years before today (or the indicator's own window). | |
| standardize | No | Return the Z-Score (standard score) instead of the raw values, i.e. how many standard deviations each value is from the mean of its own series. When combined with growth=True, the growth values are standardized instead of the raw values. | |
| show_columns | No | Comma-separated names to filter the output. For historical data use the key names visible in any response record (e.g. 'Close,Volume,Return'). For financial statements use the 'metric' field values from the response (e.g. 'Revenue,Net Income,EBITDA'). Call the tool once without this parameter to see all available names, then repeat with show_columns to reduce response size and token usage. | |
| gmdb_forecasts | No | Set to true to include the years the Global Macro Database projects (IMF World Economic Outlook, up to five years ahead); by default a yearly series ends with its last observation. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |