Query SEC data (SQL)
query_secSQL (DuckDB) over SEC filing data, for questions ACROSS MANY COMPANIES or filings: totals, comparisons, breakdowns, screens, and finding which filings to read. For one company or one filing use the other tools instead (get_filings, get_financial_history, get_filing_item...): they pick the right tags and documents, derive quarters and link every figure, which SQL here does not. Typical use: find the set with SQL, then read or verify each one with the other tools. Three datasets today:
filings: every EDGAR filing since 1993 (form, date, CIKs, 8-K Items, headline, fiscal period), each filing's files and exhibits, where each Item of a 10-K/10-Q/8-K/20-F is, and companies by SIC code, ticker and exchange. E.g. "the latest 10-Q of every listed grocery chain", "8-Ks with Item 4.02 by year", "424B5s filed in February 2024 and the issuer's 8-K within 5 days". It finds filings; read them with get_filing_item / search_document.
formd: Form D exempt offerings since 2008, every field, with the rules for reading amounts ("money raised by California biotechs this year against last year, by quarter").
xbrl: every XBRL fact in every 10-K, 10-Q, 20-F and 40-F since 2009 as filed (~376M), with the taxonomies' labels and definitions: compare one tag across companies ("the LIFO charge of every listed grocer, by quarter"), or find who reports a figure. Values as filed: no derived quarters, no standardization; join to filings by accession_number and cik.
holdings13f: every 13F manager's positions each quarter since 2013 (amendments and units resolved), managers, the SEC's 13(f) list, and per security and quarter how many managers added, cut, opened or closed ("stocks most managers bought in Q3 among those with 500+ holders"; "how Baupost's book changed since 2020").
Three steps:
No arguments: the datasets available, their form types, tables and how recent they are.
form="D", form="filings", form="xbrl" or form="13F-HR" (a form type or dataset name; any other form type gives the filing index): its tables, every field with its type and meaning, the values of its category fields, and the rules for reading it. Always read this before querying a dataset, and follow its rules.
sql="SELECT ...": one DuckDB SELECT (WITH is fine) over every dataset at once; tables need no prefix and may be joined. 15 seconds, at most 1,000 rows back: aggregate in SQL.
Each result names the snapshot it ran on (data_through, view_versions): the data is as of the last nightly build, so state that date with the answer. Every figure is what the filer reported to the SEC; the SEC does not check Form D. A filing on sec.gov: https://www.sec.gov/Archives/edgar/data///
Args: form: A form type ("D", "Form D/A") or dataset name; returns its tables, fields and rules sql: One DuckDB SELECT to run
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "query_sec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | No | ||
| form | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||