Skip to main content
Glama

get_historical_prices

Retrieve historical stock price data for companies on the Spanish stock exchange to analyze market trends and performance over time.

Instructions

Get historical price data for a company

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companyIdYesCompany ID
daysNoNumber of days of historical data

Implementation Reference

  • Core implementation of getHistoricalPrices: resolves companyId to symbol, fetches historical price data from API endpoint '/api/historical-prices/company', returns historicalData array.
    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 || []; }
  • src/index.ts:187-205 (registration)
    Tool registration in the ListToolsRequestSchema handler: defines 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'], }, },
  • Dispatch in CallToolRequestSchema handler: calls the database getHistoricalPrices method with parsed arguments.
    case 'get_historical_prices': result = await this.db.getHistoricalPrices((args as any)?.companyId, (args as any)?.days || 30); break;
  • Input schema definition for the tool: specifies companyId (required string) and optional days (number, default 30).
    inputSchema: { type: 'object', properties: { companyId: { type: 'string', description: 'Company ID', }, days: { type: 'number', description: 'Number of days of historical data', default: 30, }, }, required: ['companyId'], },

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