octagon-scraper-agent
Extract structured financial data from investor relations websites and online sources using natural language queries. Designed for gathering financial insights from platforms without accessible APIs.
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
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Your natural language query or request for the agent |
Implementation Reference
- src/index.ts:134-164 (handler)The handler function for the 'octagon-scraper-agent' tool. It takes a prompt, calls the Octagon API using the OpenAI client with model 'octagon-scraper-agent', streams the chat completion, processes the response using the helper function, and returns the formatted text content or an 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:131-133 (schema)Zod 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 registration of the 'octagon-scraper-agent' tool, specifying name, description, input schema, and handler function.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 used by the tool handler to process and accumulate the streaming response from the Octagon API.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; } }