Skip to main content
Glama
ClawyPro

Clawy MCP Server

by ClawyPro

finnhub_query

Query real-time financial data from Finnhub to access stock quotes, company news, earnings, recommendations, and market status for investment analysis.

Instructions

Query real-time financial data from Finnhub. Stock quotes, company news, earnings, recommendations, and market status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointYesFinnhub endpoint (e.g., quote, company-news, recommendation, earnings)
symbolNoStock symbol (e.g., AAPL, MSFT)
fromNoStart date (YYYY-MM-DD) for news/earnings
toNoEnd date (YYYY-MM-DD)

Implementation Reference

  • The handler for the `finnhub_query` tool is dynamically registered in `src/index.ts`. It utilizes `gatewayRequest` to perform the action based on the tool's endpoint defined in `src/tools/finnhub.ts`.
    server.tool(
      tool.name,
      tool.description,
      tool.inputSchema.shape,
      async (params) => {
        const method = tool.method || "POST";
        const result = await gatewayRequest(method, tool.endpoint, params as Record<string, unknown>);
    
        if (result.error) {
          return {
            content: [{ type: "text" as const, text: `Error (${result.status}): ${result.error}` }],
            isError: true,
          };
        }
    
        const text = typeof result.data === "string"
          ? result.data
          : JSON.stringify(result.data, null, 2);
    
        return {
          content: [{ type: "text" as const, text }],
        };
      },
    );
  • Schema definition for the input arguments required by the `finnhub_query` tool.
    inputSchema: z.object({
      endpoint: z.string().describe("Finnhub endpoint (e.g., quote, company-news, recommendation, earnings)"),
      symbol: z.string().optional().describe("Stock symbol (e.g., AAPL, MSFT)"),
      from: z.string().optional().describe("Start date (YYYY-MM-DD) for news/earnings"),
      to: z.string().optional().describe("End date (YYYY-MM-DD)"),
    }),
  • Registration of the `finnhub_query` tool definition, including its name, description, schema, and API endpoint.
    {
      name: "finnhub_query",
      description: "Query real-time financial data from Finnhub. Stock quotes, company news, earnings, recommendations, and market status.",
      inputSchema: z.object({
        endpoint: z.string().describe("Finnhub endpoint (e.g., quote, company-news, recommendation, earnings)"),
        symbol: z.string().optional().describe("Stock symbol (e.g., AAPL, MSFT)"),
        from: z.string().optional().describe("Start date (YYYY-MM-DD) for news/earnings"),
        to: z.string().optional().describe("End date (YYYY-MM-DD)"),
      }),
      endpoint: "/v1/finnhub/query",
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ClawyPro/clawy-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server