Skip to main content
Glama

get_top_expressed_genes

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

Instructions

Get top expressed genes in a specific tissue

Input Schema

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

Implementation Reference

  • Main handler function that executes the tool: validates input, fetches data via API client, computes statistics, and returns formatted Markdown response.
    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 }] }; }
  • Tool schema definition: name, description, and detailed inputSchema specifying parameters like tissueSiteDetailId (required), filterMtGenes, sort options, and 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/dispatch in main request handler: matches tool name and calls the specific expression handler 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: constructs query parameters and makes HTTP GET request to GTEx API endpoint for top expressed genes data.
    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[]>; } }

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