get_stock_info
Retrieve basic stock metadata including company name, exchange, industry, last price, and percent change. Use to quickly identify a stock by its ticker symbol.
Instructions
Return basic metadata for a stock — full company name, exchange, industry, last close price, and percent change. Use this when you first encounter a symbol and need to identify it. Lighter than get_stock_report (composite) or get_candles (full history). Returns { symbol, symbol_name, last_price, percent_change, exchange, industry }. Returns NOT_FOUND for unknown tickers.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock ticker, e.g. AAPL |
Implementation Reference
- src/tools/stocks.ts:42-52 (handler)The actual handler function for get_stock_info. It validates input via GetStockInfoInputSchema, uppercases the symbol, and fetches stock metadata from the API with 5-minute cache.
export async function handleGetStockInfo( ctx: McpContext, rawArgs: unknown ): Promise<unknown> { const args = GetStockInfoInputSchema.parse(rawArgs); const sym = args.symbol.toUpperCase(); const key = `stock:${sym}`; return ctx.cache.wrap(key, 300_000, () => ctx.apiClient.get(`/stocks/${encodeURIComponent(sym)}`) ); } - src/tools/stocks.ts:8-13 (schema)Zod input schema for get_stock_info — accepts a single 'symbol' field (string, 1-20 chars, uppercase/digits/punctuation).
export const GetStockInfoInputSchema = z.object({ symbol: z .string() .regex(symbolRegex, "Invalid symbol") .describe("Stock ticker, e.g. AAPL"), }); - src/tools/index.ts:81-81 (registration)Maps the tool name 'get_stock_info' to the handler handleGetStockInfo in the HANDLERS registry.
get_stock_info: (ctx, args) => handleGetStockInfo(ctx, args), - src/tools/stocks.ts:25-32 (registration)Tool definition object — registers name, description, inputSchema, and read-only annotations for get_stock_info.
export const stockTools: Tool[] = [ { name: "get_stock_info", description: "Return basic metadata for a stock — full company name, exchange, industry, last close price, and percent change. Use this when you first encounter a symbol and need to identify it. Lighter than get_stock_report (composite) or get_candles (full history). Returns { symbol, symbol_name, last_price, percent_change, exchange, industry }. Returns NOT_FOUND for unknown tickers.", inputSchema: z.toJSONSchema(GetStockInfoInputSchema) as Tool["inputSchema"], annotations: READ_ONLY_ANNOTATIONS, }, - src/tools/index.ts:56-56 (registration)Spreads stockTools (which includes get_stock_info) into the ALL_TOOLS array that's listed via ListToolsRequestSchema.
...stockTools,