Skip to main content
Glama
deepsuthar496

Alpha Vantage MCP Server

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesThe stock symbol (e.g., AAPL)

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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);

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/deepsuthar496/alpha-ventage-mcp'

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