Skip to main content
Glama

SEC Filing Analysis Workflow

load_filing_workflow
Read-onlyIdempotent

Load filing workflow for SEC/EDGAR metadata, 8-K events, 10-K/10-Q reports. REQUIRES get_database_schema then get_query_patterns to be called first (in that order). Call BEFORE writing SQL whenever the user asks about filing dates, filing activity, "who filed", "filed a form", filing frequency, SEC filings, EDGAR, 8-K events, 10-K/10-Q reports, proxy statements, or any query involving the sec_filings table (metadata - when/what type, not transaction detail). For insider transaction detail (shares, prices, cluster buying), use load_insider_workflow instead. Can be combined with other workflow tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changed
    • removedInput schema / properties / _content
      Removed value: -{
      -  "default": "## SEC Filing Analysis Workflow\n\n### Persona\nYou are a regulatory filing analyst who reads SEC EDGAR metadata\nto surface filing activity patterns, insider transactions, and\nmaterial event disclosures. You contextualize filings with price\nmovements and fundamentals — a cluster of Form 4 sales before an\n8-K is different from routine diversification.\n\n### Key Data Notes\n- `sec_filings`: metadata only — filing dates, form types, URLs.\n  The actual filing content (10-K text, Form 4 transaction details)\n  is NOT in the database. Always provide `filing_date`, `acceptance_datetime`,\n  and `filing_url` so users know when the filing occurred and can read it on EDGAR.\n- `form_type` has 497 distinct values. Focus on the common ones:\n  - Periodic: 10-K (annual), 10-Q (quarterly), 20-F (foreign annual), 6-K (foreign current)\n  - Events: 8-K (current report / material events)\n  - Insider: 3 (initial ownership), 4 (transaction), 5 (annual)\n  - Ownership: SC 13G/SC 13G/A (passive >5%), SC 13D/SC 13D/A (activist >5%)\n  - Proxy: DEF 14A (definitive proxy)\n  - Offerings: 424B2 (prospectus supplement), FWP (free writing prospectus), S-1/S-3\n- `items` is a VARCHAR[] array, only populated for 8-K filings (~86% empty).\n  Key item codes: '1.01'=agreement changes, '2.02'=results of operations,\n  '5.02'=officer changes, '7.01'=Reg FD, '8.01'=other events, '9.01'=exhibits.\n  Filter with `list_contains(sf.items, '2.02')`.\n- `report_date` is NULL for ~54% of rows — only meaningful for periodic\n  reports (10-K, 10-Q, 20-F). Use `filing_date` for date pre-filters.\n- `accession_number` is NOT unique per row — one filing can appear for\n  multiple symbols. Use `(accession_number, symbol)` as composite key.\n- 424B2 accounts for 33% of rows (financial sector shelf offerings).\n  Always filter by `form_type` to avoid noise.\n\n### High-Volume Results\nThe server caps query results at 200 rows. Many filing queries exceed this\n(e.g., \"all 8-K filings filed yesterday\" can return 300+). When the result\nset is likely large:\n1. **Aggregate first**: `COUNT(*) GROUP BY form_type` or `GROUP BY gics_sector`\n   to show the landscape, then let the user drill down with tighter filters.\n2. **Narrow scope**: Add market cap floor (`JOIN shibui.valuation`), sector\n   filter, or specific `items` codes to bring results under 200.\n3. **Summarize, don't list**: \"47 companies filed 8-K yesterday; 12 have\n   market cap > $10B\" is more useful than 200 raw rows.\n4. **Paginate when the user wants a full list**: If the user explicitly\n   asks for all results, use `LIMIT 200 OFFSET 0`, then `OFFSET 200`,\n   etc. Tell the user how many total rows exist (run a COUNT first)\n   and how many pages remain.\n\n### Workflow\n1. **Identify scope**: What filing types matter for the user's question?\n   Map natural language to form_types (e.g., \"insider trading\" = Forms 3/4/5,\n   \"earnings announcements\" = 8-K with items '2.02', \"annual report\" = 10-K).\n2. **Date range**: Pre-filter by `filing_date`. For insider activity, 6-12 months\n   is typical. For filing history, 2-5 years. For event studies, match the event window.\n3. **Query**: Use P19 patterns from query_patterns. Always include filing_date,\n   acceptance_datetime, and filing_url so users know when the filing occurred\n   and can click through to the actual document.\n4. **Cross-reference**: For event-driven analysis, join with stock_quotes on\n   (symbol, filing_date = date) to show price reaction. For fundamental context,\n   join with fundamentals_quarterly on symbol with nearest date.\n5. **Interpret patterns**: Clusters of insider sales may signal concerns.\n   Frequent 8-K filings may indicate corporate events. Unusual SC 13D filings\n   suggest activist interest. Present findings with appropriate caveats.\n\n### Output Format\n- **Filing List**: The displayed markdown table MUST include these three columns in every filing table — filing_date, acceptance_datetime, and filing_url (as `[View](url)`). Place them as the last three columns, in that order. Never drop them to save horizontal space.\n- **Activity Summary**: Filing counts by type and period\n- **Event Correlation**: Price changes on filing dates (when relevant)\n- **Context**: Note what the filings indicate and what they don't —\n  metadata shows *when* and *what type*, not the filing content itself\n\n### Advanced Query Patterns\n\n#### F1: Insider activity timeline with price context\n```sql\nWITH insider_filings AS (\n  SELECT sf.symbol, sf.filing_date, sf.acceptance_datetime, sf.form_type, sf.filing_url,\n    COUNT(*) OVER (\n      PARTITION BY sf.symbol\n      ORDER BY sf.filing_date\n      RANGE BETWEEN INTERVAL '30 days' PRECEDING AND CURRENT ROW\n    ) AS filings_30d\n  FROM shibui.sec_filings sf\n  WHERE sf.code = 'AAPL'\n    AND sf.form_type IN ('3', '4', '5')\n    AND sf.filing_date >= CURRENT_DATE - INTERVAL '1 year'\n),\nprices AS (\n  SELECT symbol, date, close\n  FROM shibui.stock_quotes\n  WHERE symbol = 'AAPL.NASDAQ'\n    AND date >= CURRENT_DATE - INTERVAL '1 year'\n)\nSELECT i.filing_date, i.acceptance_datetime, i.form_type, i.filings_30d,\n  p.close AS price_on_date, i.filing_url\nFROM insider_filings i\nLEFT JOIN prices p ON i.symbol = p.symbol AND i.filing_date = p.date\nORDER BY i.filing_date DESC\nLIMIT 50\n```\n\n#### F2: 8-K event impact (price change on filing date)\n```sql\nWITH events AS (\n  SELECT sf.symbol, sf.filing_date, sf.acceptance_datetime, sf.items, sf.filing_url\n  FROM shibui.sec_filings sf\n  WHERE sf.code = 'AAPL'\n    AND sf.form_type = '8-K'\n    AND sf.filing_date >= CURRENT_DATE - INTERVAL '2 years'\n),\nprices AS (\n  SELECT symbol, date, close,\n    LAG(close) OVER (PARTITION BY symbol ORDER BY date) AS prev_close\n  FROM shibui.stock_quotes\n  WHERE symbol = 'AAPL.NASDAQ'\n    AND date >= CURRENT_DATE - INTERVAL '2 years'\n)\nSELECT e.filing_date, e.acceptance_datetime, e.items,\n  ROUND(p.close, 2) AS close,\n  ROUND((p.close - p.prev_close) / NULLIF(p.prev_close, 0) * 100, 2) AS day_chg_pct,\n  e.filing_url\nFROM events e\nINNER JOIN prices p ON e.symbol = p.symbol AND e.filing_date = p.date\nWHERE p.prev_close IS NOT NULL\nORDER BY ABS((p.close - p.prev_close) / NULLIF(p.prev_close, 0)) DESC\nLIMIT 30\n```\n\n#### F3: Filing frequency anomaly detection\n```sql\nWITH monthly AS (\n  SELECT sf.symbol,\n    DATE_TRUNC('month', sf.filing_date) AS month,\n    COUNT(*) AS filing_count,\n    COUNT(*) FILTER (WHERE sf.form_type IN ('3', '4', '5')) AS insider_count,\n    COUNT(*) FILTER (WHERE sf.form_type = '8-K') AS event_count\n  FROM shibui.sec_filings sf\n  WHERE sf.code = 'AAPL'\n    AND sf.filing_date >= CURRENT_DATE - INTERVAL '2 years'\n    AND sf.form_type NOT IN ('424B2', 'FWP')\n  GROUP BY sf.symbol, DATE_TRUNC('month', sf.filing_date)\n)\nSELECT month,\n  filing_count,\n  insider_count,\n  event_count,\n  ROUND(AVG(filing_count) OVER (ORDER BY month ROWS BETWEEN 5 PRECEDING AND CURRENT ROW), 1) AS avg_6m\nFROM monthly\nORDER BY month DESC\nLIMIT 24\n```\n",
      -  "type": "string"
      -}
  2. Added

TDQS

A4.9/5.0
Behavior5/5

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

The description adds significant behavioral context beyond the annotations: it requires get_database_schema and get_query_patterns to be called first in order, must be called before writing SQL, and is scoped to metadata (not transaction detail). No contradiction with readOnlyHint or idempotentHint.

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

Conciseness5/5

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

The description is information-dense but well-structured: it opens with the core purpose, moves to prerequisites (in order), lists explicit use cases, provides an alternative, and ends with combination flexibility. Every sentence earns its place with no redundancy.

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?

Given zero parameters, an output schema, and strong annotations, the description is highly complete. It covers purpose, usage triggers, prerequisites, alternatives, and combination options. The output schema handles return values, so no further description is needed.

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

Parameters4/5

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

The tool has zero parameters and 100% schema description coverage, so the baseline is 4 per instructions. The description does not need to add parameter details, and it correctly focuses on the workflow's scope.

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?

The description clearly states the tool loads a workflow for SEC/EDGAR metadata, 8-K events, and 10-K/10-Q reports, using a specific verb and resource. It also differentiates from the sibling tool load_insider_workflow by explicitly noting it handles metadata, not transaction detail.

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?

Provides explicit when-to-use guidance with specific triggers ('filing dates', 'who filed', 'SEC filings', etc.) and an explicit alternative ('For insider transaction detail... use load_insider_workflow instead'). It also notes required prerequisite calls and that it can be combined with other workflows.

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.

TDQS

A4.4/5.0
Disambiguation4/5

Most tools have clearly distinct domains (backtesting, comparison, earnings, filings, fundamentals, insider, screening, technical), and descriptions provide specific trigger conditions. However, stock_data_query and export_to_excel are very similar (same query, different output), and some workflow boundaries overlap (e.g., earnings vs. fundamental both mention revenue trends; filing vs. insider both involve SEC documents).

Naming Consistency3/5

All names use snake_case, but the pattern is inconsistent: get_database_schema and get_query_patterns follow verb_noun, the eight load_*_workflow tools follow verb_noun (consistent among themselves), but stock_data_query is a noun phrase with no verb, and export_to_excel includes a preposition. The mixed conventions are still readable but not uniform.

Tool Count4/5

At 12 tools, the count is within the expected 3-15 range and appropriate for the broad scope of comprehensive stock analysis. However, eight of the tools are 'load_*_workflow' entries that are structurally identical, which makes the set feel slightly heavier than necessary, though each covers a distinct analytical domain.

Completeness5/5

The tool set covers the full lifecycle of the domain: schema discovery, query guidance, raw query execution, export in a branded format, and eight specialized workflows covering backtesting, comparisons, earnings, filings, fundamentals, insider trading, screening, and technical analysis. No significant gaps are apparent for the stated purpose of US stock/financial data analysis.

Resources