Skip to main content
Glama

get_companies_with_pe_ratio

Filter companies in the Spanish stock exchange by P/E ratio range to identify investment opportunities based on valuation metrics.

Instructions

Get companies filtered by P/E ratio range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
minPENoMinimum P/E ratio
maxPENoMaximum P/E ratio

Implementation Reference

  • src/index.ts:87-103 (registration)
    Registration of the 'get_companies_with_pe_ratio' tool, including name, description, and input schema definition.
    {
      name: 'get_companies_with_pe_ratio',
      description: 'Get companies filtered by P/E ratio range',
      inputSchema: {
        type: 'object',
        properties: {
          minPE: {
            type: 'number',
            description: 'Minimum P/E ratio',
          },
          maxPE: {
            type: 'number',
            description: 'Maximum P/E ratio',
          },
        },
      },
    },
  • Handler dispatch in the main CallToolRequest handler that invokes the database method with parsed arguments.
    case 'get_companies_with_pe_ratio':
      result = await this.db.getCompaniesWithPERatio((args as any)?.minPE, (args as any)?.maxPE);
      break;
  • Core implementation of the tool logic: fetches all companies and filters those within the specified P/E ratio range using price_to_earnings or pe_ratio fields.
    async getCompaniesWithPERatio(minPE?: number, maxPE?: number): Promise<any[]> {
      const companies = await this.getAllCompanies();
      return companies.filter(company => {
        const pe = company.price_to_earnings || company.pe_ratio;
        if (pe === null || pe === undefined) return false;
        
        if (minPE !== undefined && pe < minPE) return false;
        if (maxPE !== undefined && pe > maxPE) return false;
        return true;
      });
    }
  • Input schema definition for the tool, specifying optional minPE and maxPE numeric parameters.
    inputSchema: {
      type: 'object',
      properties: {
        minPE: {
          type: 'number',
          description: 'Minimum P/E ratio',
        },
        maxPE: {
          type: 'number',
          description: 'Maximum P/E ratio',
        },
      },
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'gets' companies, implying a read operation, but lacks details on permissions, rate limits, pagination, or output format. The description does not contradict annotations, but it fails to provide essential behavioral context for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, with no redundant or verbose elements, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (filtering by numeric range), no annotations, and no output schema, the description is minimally adequate. It specifies the filtering criterion but lacks details on output format, error handling, or integration with other tools. The description is complete enough for basic use but leaves gaps in behavioral and contextual information.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters ('minPE' and 'maxPE') clearly documented in the schema. The description adds no additional meaning beyond the schema, such as explaining the P/E ratio concept, default values, or handling of edge cases. Baseline 3 is appropriate when the schema fully covers parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get companies filtered by') and the resource ('companies'), specifying the filtering criterion ('P/E ratio range'). It distinguishes from generic sibling tools like 'get_all_companies' by focusing on P/E ratio filtering, but does not explicitly differentiate from other filtering tools like 'get_companies_by_sector' beyond the criterion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites, context for P/E ratio analysis, or comparisons to other filtering tools (e.g., 'get_companies_by_sector' or 'screen_opportunities'), leaving the agent to infer usage based solely on the tool name and description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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