Skip to main content
Glama

search_by_gene

Find proteins using gene names or symbols, with options to filter by organism and control result quantity.

Instructions

Search for proteins by gene name or symbol

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geneYesGene name or symbol (e.g., BRCA1, INS)
organismNoOrganism name or taxonomy ID to filter results
sizeNoNumber of results to return (1-500, default: 25)

Implementation Reference

  • The handler function that executes the tool: validates args, constructs UniProt search query using gene:"{gene}" optionally with organism filter, fetches from /uniprotkb/search API, returns JSON results or error.
    private async handleSearchByGene(args: any) {
      if (!isValidGeneSearchArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid gene search arguments');
      }
    
      try {
        let query = `gene:"${args.gene}"`;
        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 gene: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • src/index.ts:427-437 (registration)
    Tool registration in ListToolsRequestSchema handler: defines name, description, and input schema.
    name: 'search_by_gene',
    description: 'Search for proteins by gene name or symbol',
    inputSchema: {
      type: 'object',
      properties: {
        gene: { type: 'string', description: 'Gene name or symbol (e.g., BRCA1, INS)' },
        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: ['gene'],
    },
  • Helper validation function (type guard) for search_by_gene input arguments.
    const isValidGeneSearchArgs = (
      args: any
    ): args is { gene: string; organism?: string; size?: number } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.gene === 'string' &&
        (args.organism === undefined || typeof args.organism === 'string') &&
        (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 500))
      );
    };
  • src/index.ts:733-733 (registration)
    Dispatch registration in CallToolRequestSchema switch statement.
    return this.handleSearchByGene(args);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Search' implies a read-only operation, the description doesn't address important behavioral aspects like whether this is a fuzzy or exact match search, what format results are returned in, whether there are rate limits, authentication requirements, or what happens when no matches are found. For a search tool with zero annotation coverage, this is insufficient.

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 immediately conveys the core functionality without unnecessary words. It's appropriately sized for a search tool and front-loads the essential information, making it easy for an agent to quickly understand what the tool does.

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 lack of annotations and output schema, the description is incomplete for a search tool with 3 parameters. It doesn't explain what kind of results are returned (protein IDs, names, sequences?), how results are formatted, whether there's pagination, or what happens with partial/no matches. For a tool that likely returns complex protein data, more context about the output would be helpful.

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 description mentions 'gene name or symbol' which aligns with the 'gene' parameter in the schema, but doesn't add meaningful semantic context beyond what the 100% schema coverage already provides. The schema descriptions fully document each parameter's purpose, constraints, and examples, so the description adds minimal additional value regarding parameter meaning or usage.

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 ('Search for proteins') and the target resource ('by gene name or symbol'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'search_by_function' or 'search_proteins', which would require more specific language about when to use gene-based searching versus other search methods.

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 multiple search-related sibling tools (search_by_function, search_by_localization, search_by_taxonomy, search_proteins), there's no indication of when gene-based searching is appropriate versus other search methods or what distinguishes this from the generic 'search_proteins' tool.

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