MCPサーバー

treasury-fiscaldata-mcp-server

io.github.cyanheads/treasury-fiscaldata-mcp-server
データ・分析 金融・投資 公開・接続可能 MCP 2025-11-25

このMCPでできること

Queries US Treasury fiscal datasets covering national debt, interest rates, official exchange rates, and other financial indicators.

treasury_dataframe_describe
Describe Treasury Dataframes
List DataCanvas dataframes materialized by treasury_query_dataset, treasury_get_debt, treasury_get_interest_rates, and treasury_get_exchange_rates. Each entry surfaces source tool, query parameters, creation/expiry timestamps, row count, and column schema. Use this tool before treasury_dataframe_query to discover table names and column types. Requires CANVAS_PROVIDER_TYPE=duckdb.
読み取り専用 冪等
入力スキーマ
{'type': 'object', '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'name': {'type': 'string', 'description': 'Optional dataframe table name (df_XXXXX_XXXXX) to describe a single dataframe. Omit to list all active dataframes.'}}, 'additionalProperties': False}
出力スキーマ
{'type': 'object', 'anyOf': [{'not': {'required': ['error']}, 'required': ['dataframes']}, {'required': ['error']}], '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'error': {'type': 'object', 'required': ['code', 'message'], 'properties': {'code': {'type': 'integer', 'maximum': 9007199254740991, 'minimum': -9007199254740991, 'description': 'JSON-RPC error code for this failure.'}, 'data': {'type': 'object', 'properties': {'reason': {'type': 'string', 'examples': ['canvas_unavailable'], 'description': 'Machine-readable failure mode. Declared by this tool: `canvas_unavailable`: CANVAS_PROVIDER_TYPE is not set to duckdb. Other values are possible when a failure originates below the handler.'}, 'recovery': {'type': 'object', 'required': ['hint'], 'properties': {'hint': {'type': 'string'}}, 'description': 'Actionable next step for the caller.', 'additionalProperties': {}}, 'retryable': {'type': 'boolean', 'description': 'Whether retrying may succeed.'}}, 'additionalProperties': {}}, 'message': {'type': 'string', 'description': 'Human-readable description of what went wrong.'}}, 'description': 'Present when the call failed. Absent on success.', 'additionalProperties': {}}, 'dataframes': {'type': 'array', 'items': {'type': 'object', 'required': ['name', 'source_tool', 'query_params', 'created_at', 'expires_at', 'row_count', 'truncated', 'column_schema'], 'properties': {'name': {'type': 'string', 'description': 'Canvas table name (df_XXXXX_XXXXX).'}, 'max_rows': {'type': 'number', 'description': 'Materialization cap that produced `truncated`, when applicable.'}, 'row_count': {'type': 'number', 'description': 'Rows materialized in the dataframe.'}, 'truncated': {'type': 'boolean', 'description': 'True when the upstream source had more rows than were materialized.'}, 'created_at': {'type': 'string', 'description': 'ISO 8601 creation timestamp.'}, 'expires_at': {'type': 'string', 'description': 'ISO 8601 expiry timestamp. Sliding TTL touched on every dataframe op.'}, 'source_tool': {'type': 'string', 'description': 'Treasury tool that produced this dataframe.'}, 'query_params': {'type': 'object', 'description': 'Input parameters the source tool was called with.', 'propertyNames': {'type': 'string'}, 'additionalProperties': {}}, 'column_schema': {'type': 'array', 'items': {'type': 'object', 'required': ['name', 'type', 'nullable'], 'properties': {'name': {'type': 'string', 'description': 'Column name.'}, 'type': {'type': 'string', 'description': 'Canvas column type (VARCHAR, BIGINT, DOUBLE, ...). Treasury API values are VARCHAR.'}, 'nullable': {'type': 'boolean', 'description': 'Whether the column permits NULL (all Treasury columns are nullable).'}}, 'description': 'One column declaration in the dataframe schema.', 'additionalProperties': False}, 'description': 'Resolved column schema.'}}, 'description': 'Provenance and schema for one dataframe.', 'additionalProperties': False}, 'description': 'Active dataframes for this tenant, newest first. Empty when none are registered.'}}, 'additionalProperties': False}
treasury_dataframe_query
Query Treasury Dataframes
Run a single-statement SELECT against DataCanvas dataframes registered by treasury_query_dataset, treasury_get_debt, treasury_get_interest_rates, and treasury_get_exchange_rates. Read-only: writes, DDL, DROP, COPY, PRAGMA, ATTACH, and external-file table functions are rejected. System catalogs (information_schema, pg_catalog, sqlite_master, duckdb_*) are denied at the bridge layer. All Treasury dataframe columns are VARCHAR — CAST to DECIMAL or DATE for arithmetic and date comparisons. Use treasury_dataframe_describe to list available table names and column schemas before querying.
読み取り専用 冪等
入力スキーマ
{'type': 'object', '$schema': 'https://json-schema.org/draft/2020-12/schema', 'required': ['sql'], 'properties': {'sql': {'type': 'string', 'minLength': 1, 'description': 'Single-statement SELECT against df_<id> tables. All values in Treasury dataframes are VARCHAR (strings) per the API contract â\x80\x94 CAST to DECIMAL or DATE for arithmetic and date comparisons. Example: SELECT record_date, CAST(tot_pub_debt_out_amt AS DECIMAL) AS debt FROM df_xxxxx ORDER BY record_date DESC LIMIT 10.'}, 'preview': {'type': 'integer', 'maximum': 10000, 'minimum': 0, 'description': 'Rows in the immediate response. Defaults to row_limit and may not exceed it. Set lower when using register_as.'}, 'row_limit': {'type': 'integer', 'default': 1000, 'maximum': 10000, 'minimum': 1, 'description': 'Hard cap on rows the query may produce. Default 1000, max 10000. A query matching more rows than this stops at the cap and row_count_capped comes back true â\x80\x94 raise it, or use register_as to materialize the whole result.'}, 'register_as': {'type': 'string', 'description': 'Persist the result as a new dataframe under this exact name, to chain analyses. The name is used verbatim â\x80\x94 any name works, and a df_ prefix keeps it consistent with the tables the data tools mint. Echoed back in registered_as.'}}, 'additionalProperties': False}
出力スキーマ
{'type': 'object', 'anyOf': [{'not': {'required': ['error']}, 'required': ['columns', 'row_count', 'row_count_capped', 'rows']}, {'required': ['error']}], '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'cap': {'type': 'number', 'description': 'The row cap that was applied â\x80\x94 preview when supplied, otherwise row_limit.'}, 'rows': {'type': 'array', 'items': {'type': 'object', 'propertyNames': {'type': 'string'}, 'additionalProperties': {}}, 'description': 'Materialized rows, bounded by preview / row_limit.'}, 'error': {'type': 'object', 'required': ['code', 'message'], 'properties': {'code': {'type': 'integer', 'maximum': 9007199254740991, 'minimum': -9007199254740991, 'description': 'JSON-RPC error code for this failure.'}, 'data': {'type': 'object', 'properties': {'reason': {'type': 'string', 'examples': ['canvas_unavailable', 'system_catalog_access', 'invalid_sql', 'missing_table', 'invalid_query_bounds'], 'description': 'Machine-readable failure mode. Declared by this tool: `canvas_unavailable`: CANVAS_PROVIDER_TYPE is not set to duckdb. `system_catalog_access`: SQL references a denied DuckDB system catalog (information_schema, pg_catalog, sqlite_master, duckdb_*). `invalid_sql`: SQL is not a SELECT, contains DDL/DML, or uses disallowed table functions. `missing_table`: A df_<id> table named in the SQL is not on the canvas â\x80\x94 its TTL expired, it was dropped, or it was never registered. `invalid_query_bounds`: preview exceeds row_limit, or row_limit exceeds the row ceiling this server allows. Other values are possible when a failure originates below the handler.'}, 'recovery': {'type': 'object', 'required': ['hint'], 'properties': {'hint': {'type': 'string'}}, 'description': 'Actionable next step for the caller.', 'additionalProperties': {}}, 'retryable': {'type': 'boolean', 'description': 'Whether retrying may succeed.'}}, 'additionalProperties': {}}, 'message': {'type': 'string', 'description': 'Human-readable description of what went wrong.'}}, 'description': 'Present when the call failed. Absent on success.', 'additionalProperties': {}}, 'shown': {'type': 'number', 'description': 'Number of rows returned in this response.'}, 'notice': {'type': 'string', 'description': 'Guidance when the query returned no rows, or when results were capped by preview or row_limit.'}, 'columns': {'type': 'array', 'items': {'type': 'string'}, 'description': 'Column names in projection order.'}, 'row_count': {'type': 'number', 'description': 'Rows the query produced, up to row_limit. Exceeds rows.length when preview returned fewer. Read with row_count_capped: when that is true this number is row_limit itself, and the size of the full result is not in this response.'}, 'truncated': {'type': 'boolean', 'description': 'True when the returned rows were capped below the full result set.'}, 'expires_at': {'type': 'string', 'description': 'ISO 8601 expiry timestamp for the newly registered dataframe, when applicable.'}, 'registered_as': {'type': 'string', 'description': 'Set when register_as was supplied and the new dataframe was materialized.'}, 'row_count_capped': {'type': 'boolean', 'description': 'True when the query matched more rows than row_limit, so row_count is that cap rather than a total. False means row_count is exact â\x80\x94 including when it happens to equal row_limit.'}}, 'additionalProperties': False}
treasury_get_debt
Get National Debt
Fetch national debt (Debt to the Penny) — total public debt outstanding broken into publicly-held debt and intragovernmental holdings. Three modes: "latest" returns the most recent business day's record; "date" returns the record for a specific date (must be a business day — the API only records debt on days markets are open); "series" returns a date range, staging the full result as a DataCanvas table when canvas_id is set or the range matches more than 500 rows — read the table's column schema with treasury_dataframe_describe, then run SQL over it with treasury_dataframe_query. Records go back to 1993-04-01.
読み取り専用 冪等
入力スキーマ
{'type': 'object', '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'date': {'type': 'string', 'description': 'ISO 8601 date (YYYY-MM-DD) for mode=date. Must be a business day; the API only records debt on days the market is open.'}, 'mode': {'enum': ['latest', 'date', 'series'], 'type': 'string', 'default': 'latest', 'description': '"latest" returns the most recent day\'s record. "date" returns the record for a specific date. "series" returns a date range â\x80\x94 use with start_date and end_date.'}, 'end_date': {'type': 'string', 'description': 'ISO 8601 end date for mode=series (inclusive). Defaults to today.'}, 'canvas_id': {'type': 'string', 'description': 'Set any non-empty value to stage mode=series results as a DataCanvas table for SQL analysis â\x80\x94 the value only requests staging; the server picks the table name. Staging also happens on its own when the range matches more than 500 rows. The assigned name (df_XXXXX_XXXXX) comes back in the output canvas_id; pass it to treasury_dataframe_describe, then treasury_dataframe_query. Requires CANVAS_PROVIDER_TYPE=duckdb.'}, 'start_date': {'type': 'string', 'description': 'ISO 8601 start date for mode=series (inclusive). Fiscal Data has daily debt records back to 1993-04-01.'}}, 'additionalProperties': False}
出力スキーマ
{'type': 'object', 'anyOf': [{'not': {'required': ['error']}, 'required': ['record_date', 'total_debt', 'debt_held_public', 'intragovernmental_holdings']}, {'required': ['error']}], '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'cap': {'type': 'number', 'description': 'The preview cap applied to the inline series array.'}, 'error': {'type': 'object', 'required': ['code', 'message'], 'properties': {'code': {'type': 'integer', 'maximum': 9007199254740991, 'minimum': -9007199254740991, 'description': 'JSON-RPC error code for this failure.'}, 'data': {'type': 'object', 'properties': {'reason': {'type': 'string', 'examples': ['no_data_for_date'], 'description': 'Machine-readable failure mode. Declared by this tool: `no_data_for_date`: No debt record exists for the requested date (API returns HTTP 200 with empty data[], not 404 â\x80\x94 total-count is 0). Other values are possible when a failure originates below the handler.'}, 'recovery': {'type': 'object', 'required': ['hint'], 'properties': {'hint': {'type': 'string'}}, 'description': 'Actionable next step for the caller.', 'additionalProperties': {}}, 'retryable': {'type': 'boolean', 'description': 'Whether retrying may succeed.'}}, 'additionalProperties': {}}, 'message': {'type': 'string', 'description': 'Human-readable description of what went wrong.'}}, 'description': 'Present when the call failed. Absent on success.', 'additionalProperties': {}}, 'shown': {'type': 'number', 'description': 'Series rows returned inline.'}, 'notice': {'type': 'string', 'description': 'Guidance when the inline series is a preview, when the series was staged as a DataCanvas table, or when paging stopped before the full matched set.'}, 'series': {'type': 'array', 'items': {'type': 'object', 'required': ['record_date', 'total_debt', 'debt_held_public', 'intragovernmental_holdings'], 'properties': {'total_debt': {'type': 'string', 'description': 'Total public debt outstanding in USD.'}, 'record_date': {'type': 'string', 'description': 'Date of this record (YYYY-MM-DD).'}, 'debt_held_public': {'type': 'string', 'description': 'Debt held by the public in USD.'}, 'intragovernmental_holdings': {'type': 'string', 'description': 'Intragovernmental holdings in USD.'}}, 'description': 'One daily debt record.', 'additionalProperties': False}, 'description': 'Inline preview of the mode=series records â\x80\x94 at most 20 rows, newest first. Compare series.length against retrieved_records to detect the cap; the full retrieved set is reachable through canvas_id when one is returned.'}, 'canvas_id': {'type': 'string', 'description': 'DuckDB table name (df_XXXXX_XXXXX) holding the full retrieved series. Pass it to treasury_dataframe_describe for the column schema, then use it as the FROM target in treasury_dataframe_query SQL. Absent when nothing was staged.'}, 'truncated': {'type': 'boolean', 'description': 'True when the inline series array holds fewer rows than were retrieved.'}, 'total_debt': {'type': 'string', 'description': 'Total public debt outstanding in USD, as a plain decimal string â\x80\x94 no separators, no currency symbol, two decimal places. Convert as needed.'}, 'record_date': {'type': 'string', 'description': 'Date of this debt record (YYYY-MM-DD). For series mode, the most recent date.'}, 'total_records': {'type': 'number', 'description': 'Records matching the date range upstream. Exceeds retrieved_records when the match is larger than the series row bound.'}, 'debt_held_public': {'type': 'string', 'description': 'Debt held by the public (external creditors, Fed, foreign governments) in USD.'}, 'canvas_expires_at': {'type': 'string', 'description': 'ISO 8601 expiry for the canvas dataframe.'}, 'retrieved_records': {'type': 'number', 'description': 'Records actually fetched for mode=series across every page, and the row count of the canvas table when one was registered. Never larger than total_records.'}, 'intragovernmental_holdings': {'type': 'string', 'description': 'Intragovernmental holdings (debt owed to federal trust funds, Social Security, etc.) in USD.'}}, 'additionalProperties': False}
treasury_get_exchange_rates
Get Treasury Exchange Rates
Official Treasury reporting exchange rates for ~165 countries — the rates US federal agencies are required to use when converting foreign currency to USD for official reporting. Published quarterly (March 31, June 30, Sep 30, Dec 31); mode "latest" returns the most recently published quarter. Rate is expressed as foreign currency units per 1 USD (e.g., a Japan-Yen rate of 159.41 means 1 USD = 159.41 JPY). These are NOT market exchange rates and are not suitable for financial transaction pricing. Mode "series" stages the result as a DataCanvas table when canvas_id is set or the range matches more than 500 rows — read the table's column schema with treasury_dataframe_describe, then run SQL over it with treasury_dataframe_query.
読み取り専用 冪等
入力スキーマ
{'type': 'object', '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'mode': {'enum': ['latest', 'series'], 'type': 'string', 'default': 'latest', 'description': '"latest" returns the most recently published quarter\'s rates. "series" returns a date range of quarterly reports.'}, 'end_date': {'type': 'string', 'description': 'ISO 8601 end date for mode=series.'}, 'canvas_id': {'type': 'string', 'description': 'Set any non-empty value to stage mode=series results as a DataCanvas table for SQL analysis â\x80\x94 the value only requests staging; the server picks the table name. Staging also happens on its own when a series matches more than 500 rows, which multi-year multi-country pulls do (~19,000 rows for the full history). The assigned name (df_XXXXX_XXXXX) comes back in the output canvas_id; pass it to treasury_dataframe_describe, then treasury_dataframe_query. Requires CANVAS_PROVIDER_TYPE=duckdb.'}, 'countries': {'type': 'array', 'items': {'type': 'string'}, 'description': 'Filter to specific countries by exact country name (e.g., ["Japan", "Germany", "France"]). Case-sensitive, matches the "country" field. Omit for every country in the quarter (~165).'}, 'start_date': {'type': 'string', 'description': 'ISO 8601 start date for mode=series. Rates are published end-of-quarter (March 31, June 30, Sep 30, Dec 31).'}}, 'additionalProperties': False}
出力スキーマ
{'type': 'object', 'anyOf': [{'not': {'required': ['error']}, 'required': ['as_of_date', 'effective_date', 'mixed_record_dates', 'rates', 'total_records', 'note']}, {'required': ['error']}], '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'cap': {'type': 'number', 'description': 'The preview cap applied to the inline rates array.'}, 'note': {'type': 'string', 'description': 'Contextual note reminding that these are official reporting rates, not market rates.'}, 'error': {'type': 'object', 'required': ['code', 'message'], 'properties': {'code': {'type': 'integer', 'maximum': 9007199254740991, 'minimum': -9007199254740991, 'description': 'JSON-RPC error code for this failure.'}, 'data': {'type': 'object', 'properties': {'reason': {'type': 'string', 'examples': ['country_not_found'], 'description': 'Machine-readable failure mode. Declared by this tool: `country_not_found`: One or more requested countries have no records â\x80\x94 API returns HTTP 200 with empty data[]; total-count is 0 or fewer countries were returned than requested. Other values are possible when a failure originates below the handler.'}, 'recovery': {'type': 'object', 'required': ['hint'], 'properties': {'hint': {'type': 'string'}}, 'description': 'Actionable next step for the caller.', 'additionalProperties': {}}, 'retryable': {'type': 'boolean', 'description': 'Whether retrying may succeed.'}}, 'additionalProperties': {}}, 'message': {'type': 'string', 'description': 'Human-readable description of what went wrong.'}}, 'description': 'Present when the call failed. Absent on success.', 'additionalProperties': {}}, 'rates': {'type': 'array', 'items': {'type': 'object', 'required': ['country', 'currency', 'country_currency_desc', 'exchange_rate', 'record_date', 'effective_date'], 'properties': {'country': {'type': 'string', 'description': 'Country name.'}, 'currency': {'type': 'string', 'description': 'Currency name.'}, 'record_date': {'type': 'string', 'description': 'Quarter-end record date this rate was published under (YYYY-MM-DD).'}, 'exchange_rate': {'type': 'string', 'description': 'Foreign currency units per 1 USD. A value of 159.41 for Japan-Yen means 1 USD = 159.41 JPY.'}, 'effective_date': {'type': 'string', 'description': 'Date this rate takes effect (YYYY-MM-DD). Later than record_date when Treasury amends a rate mid-quarter, in which case the quarter carries more than one row for the country.'}, 'country_currency_desc': {'type': 'string', 'description': '"Country-Currency" combined label (e.g., "Japan-Yen"). Use for in= filter values.'}}, 'description': 'One exchange rate record.', 'additionalProperties': False}, 'description': 'Exchange rates for the requested countries/quarter, newest first. Whole in mode=latest â\x80\x94 a quarter is a bounded set. In mode=series an inline preview of at most 20 rows; compare its length against retrieved_records to detect the cap, and reach the rest through canvas_id when one is returned.'}, 'shown': {'type': 'number', 'description': 'Rate rows returned inline.'}, 'notice': {'type': 'string', 'description': 'Guidance when a requested country matched no records, when the inline series is a preview, when the series was staged as a DataCanvas table, or when the returned rows were published in more than one quarter.'}, 'canvas_id': {'type': 'string', 'description': 'DuckDB table name (df_XXXXX_XXXXX) holding the staged series. Pass it to treasury_dataframe_describe for the column schema, then use it as the FROM target in treasury_dataframe_query SQL. Absent when nothing was staged.'}, 'truncated': {'type': 'boolean', 'description': 'True when the inline rates array holds fewer rows than were retrieved.'}, 'as_of_date': {'type': 'string', 'description': 'Most recent quarter-end record_date among the returned rows (YYYY-MM-DD). Not necessarily a date every row shares â\x80\x94 check mixed_record_dates.'}, 'total_records': {'type': 'number', 'description': 'In mode=latest, the number of rows in rates. In mode=series, the full upstream match â\x80\x94 larger than rates.length whenever the preview cap applied, and larger than retrieved_records when paging stopped first.'}, 'effective_date': {'type': 'string', 'description': 'Effective date of the as_of_date row (YYYY-MM-DD). Every row carries its own effective_date; this one does not describe the rest.'}, 'canvas_expires_at': {'type': 'string', 'description': 'ISO 8601 expiry for the canvas dataframe.'}, 'retrieved_records': {'type': 'number', 'description': 'Rows actually fetched for mode=series across every page, and the row count of the canvas table when one was registered. Never larger than total_records.'}, 'mixed_record_dates': {'type': 'boolean', 'description': "True when the retrieved rows were not all published on as_of_date â\x80\x94 including rows past the inline preview. Read each row's record_date rather than applying the top-level date to the set."}}, 'additionalProperties': False}
treasury_get_interest_rates
Get Treasury Interest Rates
Average interest rates Treasury pays on its outstanding securities by security type. Answers "what is the government's cost of borrowing?" Covers every type Treasury reports — marketable issues, non-marketable series, and the aggregate totals — and which types it reports changes over the years, so omit security_type to see the ones a given period carries. Rates are percentages, not basis points. Updated monthly (end-of-month records). Mode "latest" returns the most recent month's rates for all or one security type; "series" returns a time history, staging the result as a DataCanvas table when canvas_id is set or the range matches more than 200 rows — read the table's column schema with treasury_dataframe_describe, then run SQL over it with treasury_dataframe_query.
読み取り専用 冪等
入力スキーマ
{'type': 'object', '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'mode': {'enum': ['latest', 'series'], 'type': 'string', 'default': 'latest', 'description': '"latest" returns the most recent month\'s rates. "series" returns a time range.'}, 'end_date': {'type': 'string', 'description': 'ISO 8601 end date for mode=series. Defaults to today.'}, 'canvas_id': {'type': 'string', 'description': 'Set any non-empty value to stage mode=series results as a DataCanvas table for SQL analysis â\x80\x94 the value only requests staging; the server picks the table name. Staging also happens on its own when a series matches more than 200 rows. The assigned name (df_XXXXX_XXXXX) comes back in the output canvas_id; pass it to treasury_dataframe_describe, then treasury_dataframe_query. Requires CANVAS_PROVIDER_TYPE=duckdb.'}, 'start_date': {'type': 'string', 'description': 'ISO 8601 start date for mode=series (YYYY-MM-DD, must be end-of-month for meaningful results).'}, 'security_type': {'type': 'string', 'description': 'Filter to one security type, matched exactly against the security_desc field â\x80\x94 full case and punctuation, as in "Treasury Inflation-Protected Securities (TIPS)". Omit for every type in the period, which is how to read the set of types on offer; the response names them when a filter matches nothing.'}}, 'additionalProperties': False}
出力スキーマ
{'type': 'object', 'anyOf': [{'not': {'required': ['error']}, 'required': ['as_of_date', 'rates', 'total_records']}, {'required': ['error']}], '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'cap': {'type': 'number', 'description': 'The preview cap applied to the inline series array.'}, 'error': {'type': 'object', 'required': ['code', 'message'], 'properties': {'code': {'type': 'integer', 'maximum': 9007199254740991, 'minimum': -9007199254740991, 'description': 'JSON-RPC error code for this failure.'}, 'data': {'type': 'object', 'properties': {'reason': {'type': 'string', 'description': 'Machine-readable failure mode.'}, 'recovery': {'type': 'object', 'required': ['hint'], 'properties': {'hint': {'type': 'string'}}, 'description': 'Actionable next step for the caller.', 'additionalProperties': {}}, 'retryable': {'type': 'boolean', 'description': 'Whether retrying may succeed.'}}, 'additionalProperties': {}}, 'message': {'type': 'string', 'description': 'Human-readable description of what went wrong.'}}, 'description': 'Present when the call failed. Absent on success.', 'additionalProperties': {}}, 'rates': {'type': 'array', 'items': {'type': 'object', 'required': ['record_date', 'security_type', 'security_desc', 'avg_interest_rate_pct'], 'properties': {'record_date': {'type': 'string', 'description': 'Record date (YYYY-MM-DD).'}, 'security_desc': {'type': 'string', 'description': 'Security description (e.g., Treasury Bills).'}, 'security_type': {'type': 'string', 'description': 'Security type (Marketable, Non-marketable, Interest-bearing Debt).'}, 'avg_interest_rate_pct': {'type': 'string', 'description': 'Average interest rate as a percentage string (e.g., "3.696"). Not basis points.'}}, 'description': 'One interest rate record.', 'additionalProperties': False}, 'description': 'Interest rate records, newest first. Whole in mode=latest â\x80\x94 a month is a bounded set. In mode=series an inline preview of at most 20 rows; compare its length against total_records to detect the cap, and reach the rest through canvas_id when one is returned.'}, 'shown': {'type': 'number', 'description': 'Series rows returned inline.'}, 'notice': {'type': 'string', 'description': 'Guidance when no records match (where the requested security type does have records, or the types the most recent month carries, or the empty date range), when the inline series is a preview, or when the series was staged as a DataCanvas table.'}, 'canvas_id': {'type': 'string', 'description': 'DuckDB table name (df_XXXXX_XXXXX) holding the staged series. Pass it to treasury_dataframe_describe for the column schema, then use it as the FROM target in treasury_dataframe_query SQL. Absent when nothing was staged.'}, 'truncated': {'type': 'boolean', 'description': 'True when the inline series array holds fewer rows than were retrieved.'}, 'as_of_date': {'type': 'string', 'description': 'Most recent record date returned (YYYY-MM-DD).'}, 'total_records': {'type': 'number', 'description': 'In mode=latest, the number of rows in rates. In mode=series, the full upstream match â\x80\x94 larger than rates.length whenever the preview cap applied.'}, 'canvas_expires_at': {'type': 'string', 'description': 'ISO 8601 expiry for the canvas dataframe.'}}, 'additionalProperties': False}
treasury_list_datasets
List Treasury Fiscal Data Datasets
Browse the curated catalog of US Treasury Fiscal Data API endpoints. Returns endpoint paths, field names, descriptions, and update cadence for each dataset. Use this tool before treasury_query_dataset to discover the correct endpoint path and field names — a typo in either causes a 400 error from the API. The catalog is a curated subset of the full API — pass any endpoint path directly to treasury_query_dataset to query datasets not listed here. The catalog covers debt, interest rates, exchange rates, revenue/spending, savings bonds, and securities datasets.
読み取り専用 冪等
入力スキーマ
{'type': 'object', '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'search': {'type': 'string', 'description': 'Keyword filter against dataset name and description (case-insensitive substring match). Useful for narrowing results when the category is uncertain.'}, 'category': {'enum': ['debt', 'interest_rates', 'exchange_rates', 'revenue_spending', 'savings_bonds', 'securities', 'other'], 'type': 'string', 'description': 'Filter by category. Omit to list all datasets. Options: debt, interest_rates, exchange_rates, revenue_spending, savings_bonds, securities, other.'}}, 'additionalProperties': False}
出力スキーマ
{'type': 'object', 'anyOf': [{'not': {'required': ['error']}, 'required': ['datasets', 'total']}, {'required': ['error']}], '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'error': {'type': 'object', 'required': ['code', 'message'], 'properties': {'code': {'type': 'integer', 'maximum': 9007199254740991, 'minimum': -9007199254740991, 'description': 'JSON-RPC error code for this failure.'}, 'data': {'type': 'object', 'properties': {'reason': {'type': 'string', 'description': 'Machine-readable failure mode.'}, 'recovery': {'type': 'object', 'required': ['hint'], 'properties': {'hint': {'type': 'string'}}, 'description': 'Actionable next step for the caller.', 'additionalProperties': {}}, 'retryable': {'type': 'boolean', 'description': 'Whether retrying may succeed.'}}, 'additionalProperties': {}}, 'message': {'type': 'string', 'description': 'Human-readable description of what went wrong.'}}, 'description': 'Present when the call failed. Absent on success.', 'additionalProperties': {}}, 'total': {'type': 'number', 'description': 'Total matching datasets.'}, 'datasets': {'type': 'array', 'items': {'type': 'object', 'required': ['endpoint', 'name', 'description', 'category', 'fields', 'update_cadence'], 'properties': {'name': {'type': 'string', 'description': 'Human-readable dataset name.'}, 'fields': {'type': 'array', 'items': {'type': 'object', 'required': ['name', 'label', 'type'], 'properties': {'name': {'type': 'string', 'description': 'Field name as used in fields= and filter= parameters.'}, 'type': {'type': 'string', 'description': 'Data type (DATE, CURRENCY, PERCENTAGE, STRING, INTEGER, NUMBER, etc.).'}, 'label': {'type': 'string', 'description': 'Human-readable label.'}}, 'description': 'One field available on this endpoint.', 'additionalProperties': False}, 'description': 'Fields available on this endpoint.'}, 'category': {'type': 'string', 'description': 'Broad category: debt, interest_rates, exchange_rates, revenue_spending, savings_bonds, securities, other.'}, 'endpoint': {'type': 'string', 'description': 'Endpoint path to pass to treasury_query_dataset (e.g., "/v2/accounting/od/debt_to_penny"). Include the leading slash.'}, 'description': {'type': 'string', 'description': 'What this dataset contains and when it is updated.'}, 'update_cadence': {'type': 'string', 'description': 'How often the data is updated (e.g., "Daily", "Monthly", "Quarterly").'}}, 'description': 'One dataset entry.', 'additionalProperties': False}, 'description': 'Matching datasets.'}}, 'additionalProperties': False}
treasury_query_dataset
Query Treasury Fiscal Data Dataset
Query any Treasury Fiscal Data endpoint by path, field list, filters, sort, and page. Call treasury_list_datasets first to get the correct endpoint path and exact field names — a typo in either causes a 400. Filter syntax: each condition is { field, operator, value } where operator is eq/gt/gte/lt/lte/in (e.g., record_date:gte:2024-01-01). Multiple conditions are ANDed together. All response values are strings per the API contract, including numbers and dates; "null" (string) means no value. Supply canvas_id to stage the page result as a DataCanvas table — read its column schema with treasury_dataframe_describe, then run SQL over it with treasury_dataframe_query (requires CANVAS_PROVIDER_TYPE=duckdb on the server).
読み取り専用 冪等
入力スキーマ
{'type': 'object', '$schema': 'https://json-schema.org/draft/2020-12/schema', 'required': ['endpoint'], 'properties': {'sort': {'type': 'string', 'description': 'Sort expression: field name optionally prefixed with "-" for descending (e.g., "-record_date" for newest-first).'}, 'fields': {'type': 'array', 'items': {'type': 'string'}, 'description': 'Fields to return. Omit to return all fields. Specify field names exactly as listed by treasury_list_datasets â\x80\x94 a typo causes a 400.'}, 'filters': {'type': 'array', 'items': {'type': 'object', 'required': ['field', 'operator', 'value'], 'properties': {'field': {'type': 'string', 'description': 'Field name to filter on.'}, 'value': {'anyOf': [{'type': 'string', 'minLength': 1, 'description': 'Single filter value. Dates use YYYY-MM-DD format.'}, {'type': 'array', 'items': {'type': 'string', 'minLength': 1}, 'minItems': 1, 'description': 'List of values for "in" operator.'}], 'description': 'Filter value. For "in", pass an array of strings. Dates use YYYY-MM-DD format.'}, 'operator': {'enum': ['eq', 'gt', 'gte', 'lt', 'lte', 'in'], 'type': 'string', 'description': 'Comparison operator. "in" matches any value in the provided list.'}}, 'description': 'One filter condition.', 'additionalProperties': False}, 'description': 'Filter conditions (ANDed together). Multiple filters on different fields are combined in one filter= parameter.'}, 'endpoint': {'type': 'string', 'description': 'Endpoint path returned by treasury_list_datasets (e.g., "/v2/accounting/od/debt_to_penny"). Include the leading slash.'}, 'canvas_id': {'type': 'string', 'description': 'Set any non-empty value to stage this page as a DataCanvas table for SQL analysis â\x80\x94 the value only requests staging; the server picks the table name. The assigned name (df_XXXXX_XXXXX) comes back in the output canvas_id; pass it to treasury_dataframe_describe, then treasury_dataframe_query. Omit to receive results inline only. Requires CANVAS_PROVIDER_TYPE=duckdb on the server.'}, 'page_size': {'type': 'integer', 'default': 100, 'maximum': 10000, 'minimum': 1, 'description': 'Rows per page. Default 100. Raise to 10000 to minimize round trips for small datasets. For large time-series pulls, use canvas_id with treasury_dataframe_query instead.'}, 'page_number': {'type': 'integer', 'default': 1, 'maximum': 9007199254740991, 'minimum': 1, 'description': 'Page to fetch (1-indexed). Check total_pages in the response to know if more pages exist.'}}, 'additionalProperties': False}
出力スキーマ
{'type': 'object', 'anyOf': [{'not': {'required': ['error']}, 'required': ['endpoint', 'data', 'total_count', 'total_pages', 'page_number', 'page_size', 'field_labels']}, {'required': ['error']}], '$schema': 'https://json-schema.org/draft/2020-12/schema', 'properties': {'data': {'type': 'array', 'items': {'type': 'object', 'propertyNames': {'type': 'string'}, 'additionalProperties': {'type': 'string'}}, 'description': 'Rows returned. All values are strings per API contract â\x80\x94 including numeric and date fields. Convert in the calling context. Null values appear as the string "null".'}, 'error': {'type': 'object', 'required': ['code', 'message'], 'properties': {'code': {'type': 'integer', 'maximum': 9007199254740991, 'minimum': -9007199254740991, 'description': 'JSON-RPC error code for this failure.'}, 'data': {'type': 'object', 'properties': {'reason': {'type': 'string', 'examples': ['invalid_endpoint', 'invalid_field', 'invalid_filter', 'page_out_of_range'], 'description': 'Machine-readable failure mode. Declared by this tool: `invalid_endpoint`: The endpoint path does not exist (API returns 404 HTML). `invalid_field`: A field name in fields= or filter= does not exist on this endpoint â\x80\x94 API returns JSON {"error":"Invalid Query Param","message":"...Field \'X\' does not exist..."}. `invalid_filter`: The filter expression uses an unsupported operator â\x80\x94 API returns JSON {"error":"Invalid Query Param","message":"...Operator \':op:\' is not supported..."}. `page_out_of_range`: page_number is past the last page of the matched set â\x80\x94 API returns JSON {"error":"Invalid Query Param","message":"...Page #N is out of range..."}. Other values are possible when a failure originates below the handler.'}, 'recovery': {'type': 'object', 'required': ['hint'], 'properties': {'hint': {'type': 'string'}}, 'description': 'Actionable next step for the caller.', 'additionalProperties': {}}, 'retryable': {'type': 'boolean', 'description': 'Whether retrying may succeed.'}}, 'additionalProperties': {}}, 'message': {'type': 'string', 'description': 'Human-readable description of what went wrong.'}}, 'description': 'Present when the call failed. Absent on success.', 'additionalProperties': {}}, 'notice': {'type': 'string', 'description': 'Guidance when results are empty, a field typo is suspected, the endpoint was not found in the catalog, or staging was requested.'}, 'endpoint': {'type': 'string', 'description': 'Endpoint that was queried.'}, 'canvas_id': {'type': 'string', 'description': 'DuckDB table name (df_XXXXX_XXXXX) holding this page. Pass it to treasury_dataframe_describe for the column schema, then use it as the FROM target in treasury_dataframe_query SQL. Absent when nothing was staged.'}, 'page_size': {'type': 'number', 'description': 'Rows per page.'}, 'totalCount': {'type': 'number', 'description': 'Total rows matching the query across all pages â\x80\x94 discloses that this page is a subset.'}, 'page_number': {'type': 'number', 'description': 'Current page (1-indexed).'}, 'total_count': {'type': 'number', 'description': 'Total rows matching the query (across all pages).'}, 'total_pages': {'type': 'number', 'description': 'Total pages at the current page_size.'}, 'field_labels': {'type': 'object', 'description': 'Human-readable label for each returned field.', 'propertyNames': {'type': 'string'}, 'additionalProperties': {'type': 'string'}}, 'applied_filters': {'type': 'string', 'description': 'Filter expression sent to the API, for verification.'}, 'canvas_expires_at': {'type': 'string', 'description': 'ISO 8601 expiry for the canvas dataframe.'}}, 'additionalProperties': False}
変更
treasury_dataframe_query
2026年9月23日2:42
変更
treasury_dataframe_describe
2026年9月23日2:42
変更
treasury_get_exchange_rates
2026年9月23日2:42
変更
treasury_get_debt
2026年9月23日2:42
変更
treasury_query_dataset
2026年9月23日2:42
追加
treasury_dataframe_query
2026年9月17日12:41
追加
treasury_dataframe_describe
2026年9月17日12:41
追加
treasury_get_exchange_rates
2026年9月17日12:41
追加
treasury_get_interest_rates
2026年9月17日12:41
追加
treasury_get_debt
2026年9月17日12:41
追加
treasury_query_dataset
2026年9月17日12:41
追加
treasury_list_datasets
2026年9月17日12:41