Skip to main content
Glama

get_top_expressed_genes

Identify the most highly expressed genes in specific human tissues using GTEx genomics data, with options to filter mitochondrial genes and customize sorting.

Instructions

Get top expressed genes in a specific tissue

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tissueSiteDetailIdYesTissue site detail ID (e.g., Muscle_Skeletal, Brain_Cortex)
filterMtGenesNoFilter out mitochondrial genes (default: true)
sortByNoSort criteria (default: median)median
sortDirectionNoSort direction (default: desc)desc
datasetIdNoGTEx dataset ID (default: gtex_v8)gtex_v8

Implementation Reference

  • Core handler function that validates tissueId input, calls apiClient to fetch top expressed genes, handles errors, computes expression statistics, and returns formatted markdown response with top genes list and stats.
    async getTopExpressedGenes(args: any) {
      if (!args.tissueId || typeof args.tissueId !== 'string') {
        throw new Error('tissueId parameter is required and must be a tissue ID string');
      }
    
      const result = await this.apiClient.getTopExpressedGenes(
        args.tissueId,
        args.datasetId || 'gtex_v8',
        args.filterMtGene !== false, // Default to true
        args.limit || 50
      );
    
      if (result.error) {
        return {
          content: [{
            type: "text",
            text: `Error retrieving top expressed genes: ${result.error}`
          }],
          isError: true
        };
      }
    
      const genes = result.data || [];
      if (genes.length === 0) {
        return {
          content: [{
            type: "text",
            text: `No expression data found for tissue: ${args.tissueId}`
          }]
        };
      }
    
      const tissueDisplayName = this.getTissueDisplayName(args.tissueId);
      let output = `**Top Expressed Genes in ${tissueDisplayName}**\n`;
      output += `Dataset: ${genes[0]?.datasetId}\n`;
      output += `Mitochondrial genes ${args.filterMtGene !== false ? 'excluded' : 'included'}\n`;
      output += `Showing top ${genes.length} genes\n\n`;
    
      genes.forEach((gene, index) => {
        output += `${(index + 1).toString().padStart(2)}. **${gene.geneSymbol}** (${gene.gencodeId})\n`;
        output += `    Expression: ${gene.median.toFixed(3)} ${gene.unit}\n`;
      });
    
      // Expression level analysis
      const expressions = genes.map(g => g.median);
      const stats = {
        highest: Math.max(...expressions),
        lowest: Math.min(...expressions),
        mean: expressions.reduce((sum, val) => sum + val, 0) / expressions.length,
        median: expressions[Math.floor(expressions.length / 2)]
      };
    
      output += `\n**Expression Statistics:**\n`;
      output += `  • Highest: ${stats.highest.toFixed(3)} ${genes[0].unit}\n`;
      output += `  • Lowest: ${stats.lowest.toFixed(3)} ${genes[0].unit}\n`;
      output += `  • Mean: ${stats.mean.toFixed(3)} ${genes[0].unit}\n`;
      output += `  • Median: ${stats.median.toFixed(3)} ${genes[0].unit}\n`;
    
      return {
        content: [{
          type: "text",
          text: output
        }]
      };
    }
  • Input schema defining parameters for the tool: tissueSiteDetailId (required), filterMtGenes, sortBy (median/mean), sortDirection, datasetId.
    name: "get_top_expressed_genes",
    description: "Get top expressed genes in a specific tissue",
    inputSchema: {
      type: "object",
      properties: {
        tissueSiteDetailId: {
          type: "string", 
          description: "Tissue site detail ID (e.g., Muscle_Skeletal, Brain_Cortex)"
        },
        filterMtGenes: {
          type: "boolean",
          description: "Filter out mitochondrial genes (default: true)",
          default: true
        },
        sortBy: {
          type: "string",
          description: "Sort criteria (default: median)",
          enum: ["median", "mean"],
          default: "median"
        },
        sortDirection: {
          type: "string",
          description: "Sort direction (default: desc)",
          enum: ["asc", "desc"], 
          default: "desc"
        },
        datasetId: {
          type: "string",
          description: "GTEx dataset ID (default: gtex_v8)",
          default: "gtex_v8"
        }
      },
      required: ["tissueSiteDetailId"]
    }
  • src/index.ts:637-642 (registration)
    Registration in main request handler: dispatches 'get_top_expressed_genes' tool calls to expressionHandlers.getTopExpressedGenes with mapped arguments.
    if (name === "get_top_expressed_genes") {
      return await expressionHandlers.getTopExpressedGenes({
        tissueId: args?.tissueSiteDetailId,
        filterMtGene: args?.filterMtGenes,
        datasetId: args?.datasetId
      });
  • Supporting API client utility that queries GTEx API endpoint for top expressed genes data in a tissue, handling pagination and errors.
    async getTopExpressedGenes(
      tissueSiteDetailId: string,
      datasetId: string = 'gtex_v8',
      filterMtGene: boolean = true,
      limit: number = 100
    ): Promise<GTExApiResponse<TopExpressedGene[]>> {
      try {
        const queryParams = this.buildQueryParams({
          tissueSiteDetailId,
          datasetId,
          filterMtGene,
          page: 0,
          itemsPerPage: limit
        });
        const response = await this.axiosInstance.get(`/expression/topExpressedGene?${queryParams}`);
        return { 
          data: response.data.data,
          paging_info: response.data.paging_info
        };
      } catch (error) {
        return error as GTExApiResponse<TopExpressedGene[]>;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It implies a read-only operation ('Get') but doesn't disclose rate limits, authentication needs, data freshness, or what 'top' means (e.g., top N genes, threshold-based). The lack of output schema exacerbates this, as return format and pagination are unspecified.

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, front-loaded sentence with zero wasted words. It immediately conveys the core functionality without redundancy or fluff. Every word earns its place, making it highly efficient for quick comprehension.

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?

For a tool with 5 parameters, no annotations, and no output schema, the description is inadequate. It doesn't address key contextual gaps: what constitutes 'top' (e.g., count, threshold), output format, error conditions, or dependencies on other tools like 'get_tissue_info' for valid tissue IDs. The agent lacks sufficient information to use this tool effectively beyond basic parameter passing.

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 parameters are well-documented in the schema itself. The description adds no additional parameter context beyond implying tissue specificity. It doesn't explain relationships between parameters (e.g., how 'sortBy' and 'sortDirection' interact with 'top' selection) or provide examples beyond the schema's enum values.

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') and target resource ('top expressed genes in a specific tissue'), making the purpose immediately understandable. It distinguishes itself from siblings like 'get_gene_expression' or 'get_median_gene_expression' by focusing on ranking genes by expression level rather than raw expression values. However, it doesn't explicitly contrast with all similar tools like 'get_tissue_specific_genes'.

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 like 'get_gene_expression' or 'get_tissue_specific_genes'. It doesn't mention prerequisites (e.g., needing a valid tissue ID), exclusions, or typical use cases. The agent must infer usage solely from the tool name and parameters.

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