get_stock_price
Retrieve real-time stock price data by entering a stock symbol to access current market values for investment analysis and tracking.
Instructions
Get real-time stock price information
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"symbol": "<symbol>"
},
"name": "get_stock_price"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | The stock symbol (e.g., AAPL) |
Implementation Reference
- src/index.ts:219-234 (handler)The handler function that executes the get_stock_price tool by querying the Alpha Vantage API's GLOBAL_QUOTE endpoint and returning the JSON response as text content.
private async getStockPrice(args: any) { const response = await this.axiosInstance.get('', { params: { function: 'GLOBAL_QUOTE', symbol: args.symbol, }, }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } - src/index.ts:96-105 (schema)Input schema definition for the get_stock_price tool, specifying an object with a required 'symbol' string property.
inputSchema: { type: 'object', properties: { symbol: { type: 'string', description: 'The stock symbol (e.g., AAPL)', }, }, required: ['symbol'], }, - src/index.ts:93-106 (registration)Registration of the get_stock_price tool in the ListTools response, including name, description, and input schema.
{ name: 'get_stock_price', description: 'Get real-time stock price information', inputSchema: { type: 'object', properties: { symbol: { type: 'string', description: 'The stock symbol (e.g., AAPL)', }, }, required: ['symbol'], }, }, - src/index.ts:53-54 (registration)Dispatch case in the CallToolRequestHandler switch statement that routes to the getStockPrice handler.
case 'get_stock_price': return await this.getStockPrice(request.params.arguments);