Skip to main content
Glama

get_historical_prices

Retrieve historical stock price data for Spanish companies to analyze market trends and performance over specified time periods.

Instructions

Get historical price data for a company

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companyIdYesCompany ID
daysNoNumber of days of historical data

Implementation Reference

  • Defines the tool schema for get_historical_prices including name, description, and input schema.
    {
      name: 'get_historical_prices',
      description: 'Get historical price data for a company',
      inputSchema: {
        type: 'object',
        properties: {
          companyId: {
            type: 'string',
            description: 'Company ID',
          },
          days: {
            type: 'number',
            description: 'Number of days of historical data',
            default: 30,
          },
        },
        required: ['companyId'],
      },
    },
  • src/index.ts:617-619 (registration)
    Registers the tool handler in the MCP CallToolRequestSchema switch statement, delegating to DatabaseManager.
    case 'get_historical_prices':
      result = await this.db.getHistoricalPrices((args as any)?.companyId, (args as any)?.days || 30);
      break;
  • Implements the core logic for retrieving historical prices by resolving company ID to symbol and calling the API endpoint.
    async getHistoricalPrices(companyId: string, days: number = 30): Promise<any[]> {
      // Find company symbol from ID
      const companies = await this.getAllCompanies();
      const company = companies.find(c => c.id === companyId);
      if (!company) return [];
    
      const data = await this.fetchAPI('/api/historical-prices/company', {
        symbol: company.symbol,
        days: days
      });
      
      return data.historicalData || [];
    }

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/anbrme/ibex35-mcp-server'

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