octagon-agent
Analyze market intelligence by orchestrating agents to combine SEC filings, earnings calls, financial metrics, stock data, institutional holdings, private company research, funding analysis, M&A transactions, investor intelligence, and debt analysis for holistic insights across public and private markets.
Instructions
[COMPREHENSIVE MARKET INTELLIGENCE] Orchestrates all agents for comprehensive market intelligence analysis. Capabilities: Combines insights from SEC filings, earnings calls, financial metrics, stock data, institutional holdings, private company research, funding analysis, M&A transactions, investor intelligence, and debt analysis to provide holistic market intelligence. Best for: Complex research requiring multiple data sources and comprehensive analysis across public and private markets. Example queries: 'Retrieve year-over-year growth in key income-statement items for AAPL, limited to 5 records and filtered by period FY', 'Analyze the latest 10-K filing for AAPL and extract key financial metrics and risk factors', 'Retrieve the daily closing prices for AAPL over the last 30 days', 'Analyze AAPL's latest earnings call transcript and extract key insights about future guidance', 'Provide a comprehensive overview of Stripe, including its business model and key metrics', 'Retrieve the funding history for Stripe, including all rounds and investors'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Your natural language query or request for the agent |
Implementation Reference
- src/index.ts:95-124 (handler)The handler function that executes the 'octagon-agent' tool logic. It invokes the Octagon API's 'octagon-agent' model with the provided prompt, processes the streaming response using the processStreamingResponse helper, and returns the result as MCP content or an error.try { const response = await octagonClient.chat.completions.create({ model: "octagon-agent", messages: [{ role: "user", content: prompt }], stream: true, metadata: { tool: "mcp" } }); const result = await processStreamingResponse(response); return { content: [ { type: "text", text: result, }, ], }; } catch (error) { console.error("Error calling Octagon orchestration agent:", error); return { isError: true, content: [ { type: "text", text: `Error: Failed to process comprehensive market intelligence query. ${error}`, }, ], }; } }
- src/index.ts:92-94 (schema)The Zod input schema for the 'octagon-agent' tool, defining a single 'prompt' parameter.prompt: z.string().describe("Your natural language query or request for the agent"), }, async ({ prompt }: PromptParams) => {
- src/index.ts:89-125 (registration)The MCP server.tool registration for the 'octagon-agent' tool, specifying name, description, input schema, and handler function."octagon-agent", "[COMPREHENSIVE MARKET INTELLIGENCE] Orchestrates all agents for comprehensive market intelligence analysis. Capabilities: Combines insights from SEC filings, earnings calls, financial metrics, stock data, institutional holdings, private company research, funding analysis, M&A transactions, investor intelligence, and debt analysis to provide holistic market intelligence. Best for: Complex research requiring multiple data sources and comprehensive analysis across public and private markets. Example queries: 'Retrieve year-over-year growth in key income-statement items for AAPL, limited to 5 records and filtered by period FY', 'Analyze the latest 10-K filing for AAPL and extract key financial metrics and risk factors', 'Retrieve the daily closing prices for AAPL over the last 30 days', 'Analyze AAPL's latest earnings call transcript and extract key insights about future guidance', 'Provide a comprehensive overview of Stripe, including its business model and key metrics', 'Retrieve the funding history for Stripe, including all rounds and investors'.", { prompt: z.string().describe("Your natural language query or request for the agent"), }, async ({ prompt }: PromptParams) => { try { const response = await octagonClient.chat.completions.create({ model: "octagon-agent", messages: [{ role: "user", content: prompt }], stream: true, metadata: { tool: "mcp" } }); const result = await processStreamingResponse(response); return { content: [ { type: "text", text: result, }, ], }; } catch (error) { console.error("Error calling Octagon orchestration agent:", error); return { isError: true, content: [ { type: "text", text: `Error: Failed to process comprehensive market intelligence query. ${error}`, }, ], }; } } );
- src/index.ts:48-76 (helper)Helper function used by the 'octagon-agent' handler (and others) to process streaming responses from the Octagon API chat completions.async function processStreamingResponse(stream: any): Promise<string> { let fullResponse = ""; let citations: any[] = []; try { // Process the streaming response for await (const chunk of stream) { // For Chat Completions API if (chunk.choices && chunk.choices[0]?.delta?.content) { fullResponse += chunk.choices[0].delta.content; // Check for citations in the final chunk if (chunk.choices[0]?.finish_reason === "stop" && chunk.choices[0]?.citations) { citations = chunk.choices[0].citations; } } // For Responses API if (chunk.type === "response.output_text.delta") { fullResponse += chunk.text?.delta || ""; } } return fullResponse; } catch (error) { console.error("Error processing streaming response:", error); throw error; } }