FunctionTool objects in
a Python agent or workflow. BasicMCPClient uses streamable HTTP for an /mcp
URL and accepts a custom httpx.AsyncClient, which makes the SEC API header
explicit. Run it in a backend or worker; do not expose the key in a browser
application.
Make one authenticated filing call
httpx client is specific to this integration: it supplies the
x-api-key header to the streamable HTTP transport. The package also supports
OAuth clients, but an API key is the direct machine-authentication path for the
SEC API endpoint. Do not use its default in-memory OAuth token storage for a
production credential lifecycle.
BasicMCPClient and McpToolSpec are supplied by
llama-index-tools-mcp; check its package release notes
when upgrading because its MCP client API evolves independently of SEC API.
Turn the verified tools into a workflow
Passtools to a LlamaIndex FunctionAgent or workflow only after the direct
call returns the expected filing. Build the tool list during application startup
or another controlled lifecycle boundary; refresh it after an integration
upgrade instead of relying on a stale local schema. Limit the agent’s first
calls by issuer, filing form, period, and result count.
Keep filing identity in workflow state
The filing result identifies the underlying record withaccessionNumber,
filingDate, and filingUrl, plus requestId and traceparent for request
diagnostics. Save those fields in the workflow state and user-visible answer.
When other tools return provenance, freshness, or source data, retain it with
the conclusion so a reader can inspect the filing rather than trust a generated
summary alone.
Errors and limits
Treat SEC API failures as tool results to classify, not as a reason for an unbounded agent loop. Fix401; resolve 402; honor Retry-After on 429 or
a temporary 503; and narrow a request after mcp_tool_timeout. Keep the
JSON-RPC error, error.data.code, and request ID for repeatable failures.
Next step
Connect the verifiedFunctionTool list to your agent and make accession
number, filing URL, and request metadata required output for filing analysis.
