Skip to main content
Glama

search_terms

Search across biological ontology terms using advanced filters for ontologies, semantic types, and attributes to find precise terminology.

Instructions

Search across ontology terms with advanced filtering options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for ontology terms
ontologiesNoComma-separated list of ontology acronyms to search in
require_exact_matchNoRequire exact match (default: false)
suggestNoEnable suggestion mode for type-ahead (default: false)
also_search_viewsNoInclude ontology views in search (default: false)
require_definitionsNoOnly return terms with definitions (default: false)
also_search_propertiesNoSearch in properties as well (default: false)
also_search_obsoleteNoInclude obsolete terms (default: false)
cuiNoComma-separated CUIs to filter by
semantic_typesNoComma-separated semantic types to filter by
includeNoComma-separated attributes to include (e.g., prefLabel,synonym,definition)
pageNoPage number (default: 1)
pagesizeNoResults per page (default: 50, max: 500)
languageNoLanguage code (e.g., en, fr)

Implementation Reference

  • The primary handler for the 'search_terms' tool. Validates input args, builds query parameters for the BioOntology.org /search API endpoint, performs the HTTP GET request via axios, and returns the JSON response or formatted error.
    private async handleSearchTerms(args: any) {
      if (!isValidSearchTermsArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid search terms arguments');
      }
    
      try {
        const params: any = {
          q: args.query,
          apikey: this.apiKey,
        };
    
        // Add optional parameters
        if (args.ontologies) params.ontologies = args.ontologies;
        if (args.require_exact_match !== undefined) params.require_exact_match = args.require_exact_match;
        if (args.suggest !== undefined) params.suggest = args.suggest;
        if (args.also_search_views !== undefined) params.also_search_views = args.also_search_views;
        if (args.require_definitions !== undefined) params.require_definitions = args.require_definitions;
        if (args.also_search_properties !== undefined) params.also_search_properties = args.also_search_properties;
        if (args.also_search_obsolete !== undefined) params.also_search_obsolete = args.also_search_obsolete;
        if (args.cui) params.cui = args.cui;
        if (args.semantic_types) params.semantic_types = args.semantic_types;
        if (args.include) params.include = args.include;
        if (args.page) params.page = args.page;
        if (args.pagesize) params.pagesize = args.pagesize;
        if (args.language) params.language = args.language;
    
        const response = await this.apiClient.get('/search', { params });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Error searching terms: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input validation schema (type guard) for search_terms tool arguments, enforcing types and constraints like query required string, pagesize 1-500, etc. Used in the handler.
    const isValidSearchTermsArgs = (
      args: any
    ): args is {
      query: string;
      ontologies?: string;
      require_exact_match?: boolean;
      suggest?: boolean;
      also_search_views?: boolean;
      require_definitions?: boolean;
      also_search_properties?: boolean;
      also_search_obsolete?: boolean;
      cui?: string;
      semantic_types?: string;
      include?: string;
      page?: number;
      pagesize?: number;
      language?: string;
    } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.query === 'string' &&
        (args.ontologies === undefined || typeof args.ontologies === 'string') &&
        (args.require_exact_match === undefined || typeof args.require_exact_match === 'boolean') &&
        (args.suggest === undefined || typeof args.suggest === 'boolean') &&
        (args.also_search_views === undefined || typeof args.also_search_views === 'boolean') &&
        (args.require_definitions === undefined || typeof args.require_definitions === 'boolean') &&
        (args.also_search_properties === undefined || typeof args.also_search_properties === 'boolean') &&
        (args.also_search_obsolete === undefined || typeof args.also_search_obsolete === 'boolean') &&
        (args.cui === undefined || typeof args.cui === 'string') &&
        (args.semantic_types === undefined || typeof args.semantic_types === 'string') &&
        (args.include === undefined || typeof args.include === 'string') &&
        (args.page === undefined || (typeof args.page === 'number' && args.page > 0)) &&
        (args.pagesize === undefined || (typeof args.pagesize === 'number' && args.pagesize > 0 && args.pagesize <= 500)) &&
        (args.language === undefined || typeof args.language === 'string')
      );
    };
  • src/index.ts:527-549 (registration)
    Tool registration in ListToolsRequestHandler. Defines the tool name, description, and complete inputSchema matching the validator.
      name: 'search_terms',
      description: 'Search across ontology terms with advanced filtering options',
      inputSchema: {
        type: 'object',
        properties: {
          query: { type: 'string', description: 'Search query for ontology terms' },
          ontologies: { type: 'string', description: 'Comma-separated list of ontology acronyms to search in' },
          require_exact_match: { type: 'boolean', description: 'Require exact match (default: false)' },
          suggest: { type: 'boolean', description: 'Enable suggestion mode for type-ahead (default: false)' },
          also_search_views: { type: 'boolean', description: 'Include ontology views in search (default: false)' },
          require_definitions: { type: 'boolean', description: 'Only return terms with definitions (default: false)' },
          also_search_properties: { type: 'boolean', description: 'Search in properties as well (default: false)' },
          also_search_obsolete: { type: 'boolean', description: 'Include obsolete terms (default: false)' },
          cui: { type: 'string', description: 'Comma-separated CUIs to filter by' },
          semantic_types: { type: 'string', description: 'Comma-separated semantic types to filter by' },
          include: { type: 'string', description: 'Comma-separated attributes to include (e.g., prefLabel,synonym,definition)' },
          page: { type: 'number', description: 'Page number (default: 1)', minimum: 1 },
          pagesize: { type: 'number', description: 'Results per page (default: 50, max: 500)', minimum: 1, maximum: 500 },
          language: { type: 'string', description: 'Language code (e.g., en, fr)' },
        },
        required: ['query'],
      },
    },
  • src/index.ts:701-702 (registration)
    Dispatcher switch case in CallToolRequestHandler that routes 'search_terms' calls to the handleSearchTerms method.
    case 'search_terms':
      return this.handleSearchTerms(args);
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 mentions 'advanced filtering options,' which aligns with the many parameters in the schema, but doesn't describe key behaviors like whether this is a read-only operation, if it requires authentication, rate limits, pagination handling, or what the output format looks like. For a tool with 14 parameters and no annotations, this leaves significant gaps.

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. It's front-loaded with the core action ('search across ontology terms') and avoids unnecessary words. Every part of the sentence contributes meaning, making it appropriately concise.

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

Completeness2/5

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

Given the complexity (14 parameters, no output schema, no annotations), the description is insufficient. It doesn't explain the return values, error conditions, or behavioral traits like pagination or authentication needs. While the schema covers parameters well, the description fails to address broader usage context, making it incomplete for effective agent use.

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?

The schema description coverage is 100%, meaning all parameters are documented in the schema itself. The description adds minimal value beyond the schema by mentioning 'advanced filtering options,' which loosely corresponds to the boolean and filter parameters. However, it doesn't provide additional semantic context, syntax examples, or clarify interactions between parameters. Baseline 3 is appropriate as the schema does the heavy lifting.

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 verb ('search') and resource ('ontology terms'), making the purpose evident. However, it doesn't differentiate this tool from sibling tools like 'search_ontologies' or 'search_properties', which appear to search different resources. The mention of 'advanced filtering options' adds specificity but doesn't clarify sibling distinctions.

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. With siblings like 'search_ontologies' and 'search_properties' that likely search different aspects of ontologies, there's no indication of when this tool is appropriate or when to choose another. The phrase 'advanced filtering options' hints at capabilities but doesn't offer usage context.

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/Augmented-Nature/BioOntology-MCP-Server'

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