Skip to main content
Glama

search_by_function

Find proteins by Gene Ontology terms or functional keywords to identify molecules with specific biological roles.

Instructions

Search proteins by GO terms or functional annotations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
goTermNoGene Ontology term (e.g., GO:0005524)
functionNoFunctional description or keyword
organismNoOrganism name or taxonomy ID to filter results
sizeNoNumber of results to return (1-500, default: 25)

Implementation Reference

  • Main handler function implementing the 'search_by_function' tool. Builds a UniProt search query based on GO terms, function keywords, organism filter, performs API call, and returns JSON results or error.
    private async handleSearchByFunction(args: any) {
      if (!isValidFunctionSearchArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid function search arguments');
      }
    
      try {
        let query = 'reviewed:true';
    
        if (args.goTerm) {
          query += ` AND go:"${args.goTerm}"`;
        }
    
        if (args.function) {
          query += ` AND (cc_function:"${args.function}" OR ft_act_site:"${args.function}")`;
        }
    
        if (args.organism) {
          query += ` AND organism_name:"${args.organism}"`;
        }
    
        const response = await this.apiClient.get('/uniprotkb/search', {
          params: {
            query: query,
            format: 'json',
            size: args.size || 25,
          },
        });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error searching by function: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
  • src/index.ts:580-593 (registration)
    Tool registration in ListToolsRequestSchema handler, defining name, description, and input schema for 'search_by_function'.
    {
      name: 'search_by_function',
      description: 'Search proteins by GO terms or functional annotations',
      inputSchema: {
        type: 'object',
        properties: {
          goTerm: { type: 'string', description: 'Gene Ontology term (e.g., GO:0005524)' },
          function: { type: 'string', description: 'Functional description or keyword' },
          organism: { type: 'string', description: 'Organism name or taxonomy ID to filter results' },
          size: { type: 'number', description: 'Number of results to return (1-500, default: 25)', minimum: 1, maximum: 500 },
        },
        required: [],
      },
    },
  • Helper validation function isValidFunctionSearchArgs used to validate input arguments for the search_by_function tool.
    const isValidFunctionSearchArgs = (
      args: any
    ): args is { goTerm?: string; function?: string; organism?: string; size?: number } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        (args.goTerm === undefined || typeof args.goTerm === 'string') &&
        (args.function === undefined || typeof args.function === 'string') &&
        (args.organism === undefined || typeof args.organism === 'string') &&
        (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 500)) &&
        (args.goTerm !== undefined || args.function !== undefined)
      );
    };
  • src/index.ts:762-763 (registration)
    Registration of the tool handler in the CallToolRequestSchema switch statement.
      return this.handleSearchByFunction(args);
    case 'search_by_localization':
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 searches proteins but doesn't describe how results are returned (e.g., format, pagination), potential limitations (e.g., rate limits, data freshness), or error conditions. For a search tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 with zero waste. It's front-loaded with the core purpose and uses clear terminology. Every word contributes directly to understanding the tool's function without redundancy or fluff.

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 of a search tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., protein IDs, annotations), how results are structured, or any behavioral traits like performance or constraints. The high schema coverage helps with parameters, but overall context is lacking.

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%, so the schema already documents all four parameters thoroughly. The description adds no additional parameter semantics beyond implying that 'GO terms or functional annotations' map to the 'goTerm' and 'function' parameters. It doesn't clarify parameter interactions or provide examples, so it meets the baseline for high schema coverage.

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 tool's purpose: 'Search proteins by GO terms or functional annotations.' It specifies the verb ('Search'), resource ('proteins'), and search criteria ('GO terms or functional annotations'). However, it doesn't explicitly differentiate from sibling tools like 'search_by_gene' or 'search_proteins,' which likely have overlapping purposes.

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 doesn't mention sibling tools like 'search_by_gene' or 'search_proteins,' nor does it specify prerequisites, exclusions, or contextual cues for selection. Usage is implied but not articulated.

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/UniProt-MCP-Server'

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