Skip to main content
Glama
MCP-100

Stock Market MCP Server

by MCP-100

get_ticker_price

Retrieve current stock price data for any ticker symbol to monitor market values in real time.

Instructions

Get current price for a stock ticker

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock ticker symbol

Implementation Reference

  • Implements the core logic to fetch the latest intraday stock price for the given ticker symbol using the Alpha Vantage TIME_SERIES_INTRADAY API endpoint and formats the response as JSON.
    private async handleGetTickerPrice(args: any) {
      const response = await this.axiosInstance.get('', {
        params: {
          function: 'TIME_SERIES_INTRADAY',
          symbol: args.symbol,
          interval: '1min',
          outputsize: 'compact'
        }
      });
    
      const latestData = response.data['Time Series (1min)'];
      const latestTimestamp = Object.keys(latestData)[0];
      const price = latestData[latestTimestamp]['1. open'];
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({
            symbol: args.symbol,
            price: price,
            timestamp: latestTimestamp
          }, null, 2)
        }]
      };
    }
  • Input schema definition for the get_ticker_price tool, specifying an object with a required 'symbol' string property.
    inputSchema: {
      type: 'object',
      properties: {
        symbol: {
          type: 'string',
          description: 'Stock ticker symbol'
        }
      },
      required: ['symbol']
    }
  • src/index.ts:53-66 (registration)
    Tool registration in the ListTools response, including name, description, and schema.
    {
      name: 'get_ticker_price',
      description: 'Get current price for a stock ticker',
      inputSchema: {
        type: 'object',
        properties: {
          symbol: {
            type: 'string',
            description: 'Stock ticker symbol'
          }
        },
        required: ['symbol']
      }
    },
  • src/index.ts:114-115 (registration)
    Switch case in CallToolRequest handler that routes get_ticker_price calls to the handler function.
    case 'get_ticker_price':
      return await this.handleGetTickerPrice(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/MCP-100/stock-market-server'

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