Skip to main content
Glama
Ademscodeisnotsobad

Quant Companion MCP

getCurrentPrice.ts1.26 kB
/** * MCP Tool: get_current_price * * Fetch up-to-date price for a given symbol. */ import { z } from "zod"; import { getDefaultProvider } from "../marketData"; export const getCurrentPriceSchema = z.object({ symbol: z.string().describe("Stock/ETF ticker symbol (e.g., AAPL, SPY)"), }); export type GetCurrentPriceInput = z.infer<typeof getCurrentPriceSchema>; export interface GetCurrentPriceOutput { symbol: string; price: number; timestamp: string; } export async function getCurrentPrice( input: GetCurrentPriceInput ): Promise<GetCurrentPriceOutput> { const provider = getDefaultProvider(); const quote = await provider.getQuote(input.symbol); return { symbol: quote.symbol, price: quote.price, timestamp: new Date(quote.timestamp).toISOString(), }; } export const getCurrentPriceDefinition = { name: "get_current_price", description: "Fetch up-to-date price for a given stock/ETF symbol. Use this to get the current spot price before running any pricing or simulation tools.", inputSchema: { type: "object", properties: { symbol: { type: "string", description: "Stock/ETF ticker symbol (e.g., AAPL, SPY, NVDA)", }, }, required: ["symbol"], }, };

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/Ademscodeisnotsobad/Quant-Companion-MCP'

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