Skip to main content
Glama

search_genes

Search for genes by symbol, name, or description to analyze gene expression data across human and mouse tissues using GTEx genomics resources.

Instructions

Search for genes by symbol, name, or description

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (gene symbol, name, or description)
speciesNoSpecies (default: human)human
pageNoPage number for pagination (default: 0)
pageSizeNoNumber of results per page (default: 250)

Implementation Reference

  • Main handler function that executes the search_genes tool logic: validates query input, calls API client, processes gene search results from GTEx API, formats comprehensive markdown output with gene details.
    async searchGenes(args: any) {
      if (!args.query || typeof args.query !== 'string') {
        throw new Error('query parameter is required and must be a search string (gene symbol, GENCODE ID, or keyword)');
      }
    
      const result = await this.apiClient.searchGenes({
        geneId: args.query,
        gencodeVersion: args.gencodeVersion || 'v26',
        genomeBuild: args.genomeBuild || 'GRCh38/hg38',
        page: args.page || 0,
        itemsPerPage: args.itemsPerPage || 50
      });
    
      if (result.error) {
        return {
          content: [{
            type: "text",
            text: `Error searching genes: ${result.error}`
          }],
          isError: true
        };
      }
    
      const genes = result.data || [];
      if (genes.length === 0) {
        return {
          content: [{
            type: "text",
            text: `No genes found matching query: "${args.query}"`
          }]
        };
      }
    
      let output = `**Gene Search Results for "${args.query}"**\n`;
      output += `Found ${genes.length} genes\n`;
      output += `Genome: ${genes[0]?.genomeBuild}, GENCODE: ${genes[0]?.gencodeVersion}\n\n`;
    
      genes.forEach((gene, index) => {
        output += `${(index + 1).toString().padStart(2)}. **${gene.geneSymbol}** (${gene.gencodeId})\n`;
        output += `    • Location: ${gene.chromosome}:${gene.start.toLocaleString()}-${gene.end.toLocaleString()} (${gene.strand})\n`;
        output += `    • Type: ${gene.geneType}\n`;
        output += `    • Status: ${gene.geneStatus}\n`;
        if (gene.description) {
          const truncatedDesc = gene.description.length > 80 
            ? gene.description.substring(0, 80) + '...' 
            : gene.description;
          output += `    • Description: ${truncatedDesc}\n`;
        }
        if (gene.entrezGeneId) {
          output += `    • Entrez ID: ${gene.entrezGeneId}\n`;
        }
        output += `    • TSS: ${gene.tss.toLocaleString()}\n`;
      });
    
      if (result.paging_info && result.paging_info.totalNumberOfItems > genes.length) {
        output += `\n**Note:** Showing ${genes.length} of ${result.paging_info.totalNumberOfItems} total results.\n`;
      }
    
      return {
        content: [{
          type: "text",
          text: output
        }]
      };
    }
  • src/index.ts:715-720 (registration)
    MCP server tool dispatch/registration: routes 'search_genes' calls to the ReferenceHandlers.searchGenes method with mapped arguments.
    if (name === "search_genes") {
      return await referenceHandlers.searchGenes({
        query: args?.query,
        page: args?.page,
        itemsPerPage: args?.pageSize
      });
  • Tool schema definition including input validation schema for search_genes, listed in ListToolsResponse.
    name: "search_genes",
    description: "Search for genes by symbol, name, or description",
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Search query (gene symbol, name, or description)"
        },
        species: {
          type: "string", 
          description: "Species (default: human)",
          enum: ["human", "mouse"],
          default: "human"
        },
        page: {
          type: "integer",
          description: "Page number for pagination (default: 0)",
          default: 0
        },
        pageSize: {
          type: "integer",
          description: "Number of results per page (default: 250)",
          default: 250
        }
      },
      required: ["query"]
    }
  • Supporting API client method that makes HTTP request to GTEx Portal /reference/geneSearch endpoint and handles response/error.
    async searchGenes(params: SearchGenesParams): Promise<GTExApiResponse<Gene[]>> {
      try {
        const queryParams = this.buildQueryParams({
          geneId: params.geneId,
          gencodeVersion: params.gencodeVersion || 'v26',
          genomeBuild: params.genomeBuild || 'GRCh38/hg38',
          page: params.page || 0,
          itemsPerPage: params.itemsPerPage || 250
        });
        const response = await this.axiosInstance.get(`/reference/geneSearch?${queryParams}`);
        return { 
          data: response.data.data,
          paging_info: response.data.paging_info
        };
      } catch (error) {
        return error as GTExApiResponse<Gene[]>;
      }
    }
  • TypeScript interface defining parameters for gene search API calls, used by GTExApiClient.searchGenes.
    export interface SearchGenesParams {
      geneId: string;
      gencodeVersion?: string;
      genomeBuild?: string;
      page?: number;
      itemsPerPage?: number;
    }
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 searching but doesn't describe key behaviors: whether it's a read-only operation, how results are returned (e.g., pagination details beyond schema defaults), rate limits, or authentication needs. The description is minimal and lacks operational context.

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 appropriately sized for a simple search tool. Every word earns its place without redundancy.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what the search returns (e.g., gene lists, metadata), how pagination works in practice, or error conditions. For a 4-parameter tool with no structured output info, more context is needed to guide effective 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?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain query syntax or result formats). With high schema coverage, the baseline is 3, as the description doesn't compensate but doesn't need to.

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 for genes by symbol, name, or description'. It specifies the verb ('Search') and resource ('genes'), and indicates the searchable fields. However, it doesn't explicitly differentiate from sibling tools like 'search_transcripts' or 'validate_gene_id', which would require a 5.

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_transcripts' for transcript searches or 'validate_gene_id' for ID validation, nor does it specify prerequisites or exclusions. Usage is implied by the name but not explicitly stated.

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

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