finance_stock_price
Retrieve real-time stock prices with key metrics like day high/low, volume, and 52-week range for US stocks, ETFs, and indices using micropayments.
Instructions
Get real-time stock price with day high/low, volume, 52-week range, and market state. Costs $0.02 USDC per request via x402 on Base. Supports all major US stocks, ETFs, and indices.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock ticker (e.g., AAPL, MSFT, GOOGL, TSLA, AMZN) |
Implementation Reference
- src/index.ts:126-142 (handler)The tool 'finance_stock_price' is defined here. It accepts a 'symbol' argument and fetches data from the finance API.
server.registerTool( "finance_stock_price", { title: "Get Stock Price", description: `Get real-time stock price with day high/low, volume, 52-week range, and market state. Costs $0.02 USDC per request via x402 on Base. Supports all major US stocks, ETFs, and indices.`, inputSchema: { symbol: z.string().min(1).max(10).describe("Stock ticker (e.g., AAPL, MSFT, GOOGL, TSLA, AMZN)"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }, }, async ({ symbol }) => { const data = await apiFetch(`${FINANCE_API}/api/v1/stocks/price/${symbol.toUpperCase()}`); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );