Skip to main content
Glama

beatandraise.com SEC Filings

Query SEC data (SQL)

query_sec
Read-onlyIdempotent

SQL (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:

  1. No arguments: the datasets available, their form types, tables and how recent they are.

  2. 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.

  3. 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

NameRequiredDescriptionDefault
sqlNo
formNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover read-only, idempotent, non-destructive behavior, but the description adds material context beyond them: a 15-second timeout, a 1,000-row cap requiring aggregation in SQL, data freshness (last nightly build), snapshot metadata (data_through, view_versions) to report with answers, and the caveat that figures are as filed and Form D is unchecked by the SEC.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The routing rule is front-loaded, then the numbered three-step protocol, then dataset bullets with example questions. It is long and the example queries partially duplicate what step 1/2 would reveal, but nearly every line informs a real decision, so the length is mostly earned.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a general-purpose SQL tool with an output schema present, the definition supplies everything needed: dataset inventory, form-type scoping, table/field discovery via form=, join key hints (accession_number, cik), row and time limits, and freshness disclosure. Nothing an agent needs to call it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must carry the load — and it does, documenting a three-step protocol where no arguments lists datasets, form= returns tables/fields/rules for a form type or dataset name, and sql= runs one DuckDB SELECT with optional joins across unprefixed tables. It also states that the form step should always be read first, which is real semantic guidance the bare schema cannot provide.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource — DuckDB SQL over SEC filing data — and immediately scopes it to questions across many companies or filings. It names the sibling tools (get_filings, get_financial_history, get_filing_item) it is not, so an agent can route without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit when-to-use (totals, comparisons, breakdowns, screens, finding which filings to read) and when-not (one company or one filing → the other tools), plus a named workflow: find the set with SQL, then read or verify each item with the document tools. Alternatives and exclusions are both stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources