octagon-scraper-agent
Extract structured financial data from investor relations websites and online sources for investment research when APIs are unavailable.
Instructions
[PUBLIC & PRIVATE MARKET INTELLIGENCE] Specialized agent for financial data extraction from investor websites. Capabilities: Extract structured financial data from investor relations websites, tables, and online financial sources. Best for: Gathering financial data from websites that don't have accessible APIs. Example queries: 'Extract all data fields from zillow.com/san-francisco-ca/', 'Extract all data fields from www.carvana.com/cars/'.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Your natural language query or request for the agent |
Implementation Reference
- src/index.ts:134-164 (handler)Handler function that invokes the Octagon 'octagon-scraper-agent' model via OpenAI-compatible client, processes the streaming chat completion response, and returns the formatted text content or error.async ({ prompt }: PromptParams) => { try { const response = await octagonClient.chat.completions.create({ model: "octagon-scraper-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 Scraper agent:", error); return { isError: true, content: [ { type: "text", text: `Error: Failed to process web scraping query. ${error}`, }, ], }; } }
- src/index.ts:132-133 (schema)Input schema defining the 'prompt' parameter for the tool.prompt: z.string().describe("Your natural language query or request for the agent"), },
- src/index.ts:128-165 (registration)MCP server tool registration for 'octagon-scraper-agent', including name, description, schema, and handler reference.server.tool( "octagon-scraper-agent", "[PUBLIC & PRIVATE MARKET INTELLIGENCE] Specialized agent for financial data extraction from investor websites. Capabilities: Extract structured financial data from investor relations websites, tables, and online financial sources. Best for: Gathering financial data from websites that don't have accessible APIs. Example queries: 'Extract all data fields from zillow.com/san-francisco-ca/', 'Extract all data fields from www.carvana.com/cars/'.", { 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-scraper-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 Scraper agent:", error); return { isError: true, content: [ { type: "text", text: `Error: Failed to process web scraping query. ${error}`, }, ], }; } } );
- src/index.ts:48-76 (helper)Shared helper function to process streaming responses from the Octagon API, aggregating content from chat completions or responses API chunks. Used by the tool handler.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; } }