Skip to main content
Glama

get_companies_by_sector

Retrieve Spanish stock exchange companies filtered by specific sectors like Banking, Technology, or Energy to analyze market relationships and sector composition.

Instructions

Get companies filtered by sector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sectorYesSector name or partial match (e.g., Banking, Technology, Energy)

Implementation Reference

  • Handler logic in the MCP tool dispatcher switch statement that extracts the sector argument and delegates execution to the DatabaseManager's getCompaniesBySector method.
    case 'get_companies_by_sector': result = await this.db.getCompaniesBySector((args as any)?.sector); break;
  • Tool schema definition in the ListTools response, specifying name, description, and input schema that requires a 'sector' string parameter.
    { name: 'get_companies_by_sector', description: 'Get companies filtered by sector', inputSchema: { type: 'object', properties: { sector: { type: 'string', description: 'Sector name or partial match (e.g., Banking, Technology, Energy)', }, }, required: ['sector'], }, },
  • DatabaseManager method that implements the core filtering logic: fetches all companies via API and returns those whose sector name contains the provided sector string (case-insensitive partial match).
    async getCompaniesBySector(sector: string): Promise<any[]> { const companies = await this.getAllCompanies(); return companies.filter(company => company.sector && company.sector.toLowerCase().includes(sector.toLowerCase()) ); }

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