Skip to main content
Glama

get_sample_info

Retrieve sample metadata and demographic information from the GTEx Portal for genomic analysis, supporting tissue-specific queries and dataset selection.

Instructions

Get GTEx sample metadata and demographics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tissueSiteDetailIdNoTissue site detail ID (optional, for tissue-specific samples)
datasetIdNoGTEx dataset ID (default: gtex_v8)gtex_v8

Implementation Reference

  • The core handler method getSamples() in ReferenceHandlers class that implements the logic for the get_sample_info tool. It fetches sample metadata from GTEx API, handles errors, and formats detailed or summary output based on result size.
    async getSamples(args: any) {
      const result = await this.apiClient.getSamples({
        datasetId: args.datasetId || 'gtex_v8',
        sampleId: args.sampleIds,
        tissueSampleId: args.tissueSampleIds,
        subjectId: args.subjectIds,
        ageBracket: args.ageBrackets,
        sex: args.sex,
        pathCategory: args.pathCategories,
        tissueSiteDetailId: args.tissueIds,
        page: args.page || 0,
        itemsPerPage: args.itemsPerPage || 100
      });
    
      if (result.error) {
        return {
          content: [{
            type: "text",
            text: `Error retrieving sample information: ${result.error}`
          }],
          isError: true
        };
      }
    
      const samples = result.data || [];
      if (samples.length === 0) {
        return {
          content: [{
            type: "text",
            text: "No samples found matching the specified criteria."
          }]
        };
      }
    
      let output = `**Sample Information (${samples.length} samples)**\n`;
      output += `Dataset: ${samples[0]?.datasetId}\n\n`;
    
      if (samples.length <= 20) {
        // Detailed view for small result sets
        samples.forEach((sample, index) => {
          output += `### Sample ${index + 1}: ${sample.sampleId}\n`;
          output += `**Subject Information:**\n`;
          output += `  • Subject ID: ${sample.subjectId}\n`;
          output += `  • Age bracket: ${sample.ageBracket}\n`;
          output += `  • Sex: ${sample.sex}\n`;
          output += `  • Hardy Scale: ${sample.hardyScale}\n`;
    
          output += `\n**Sample Details:**\n`;
          output += `  • Tissue sample ID: ${sample.tissueSampleId}\n`;
          output += `  • Tissue: ${sample.tissueSiteDetail} (${sample.tissueSiteDetailId})\n`;
          if (sample.aliquotId) {
            output += `  • Aliquot ID: ${sample.aliquotId}\n`;
          }
          output += `  • Data type: ${sample.dataType}\n`;
    
          if (sample.ischemicTime !== undefined) {
            output += `\n**Sample Quality:**\n`;
            output += `  • Ischemic time: ${sample.ischemicTime} min (${sample.ischemicTimeGroup})\n`;
            if (sample.rin !== undefined) {
              output += `  • RIN: ${sample.rin}\n`;
            }
            if (sample.autolysisScore) {
              output += `  • Autolysis score: ${sample.autolysisScore}\n`;
            }
          }
    
          if (sample.pathologyNotes) {
            output += `\n**Pathology Notes:** ${sample.pathologyNotes}\n`;
          }
          output += '\n';
        });
      } else {
        // Summary view for large result sets
        const tissueGroups: { [key: string]: any[] } = {};
        samples.forEach(sample => {
          if (!tissueGroups[sample.tissueSiteDetailId]) {
            tissueGroups[sample.tissueSiteDetailId] = [];
          }
          tissueGroups[sample.tissueSiteDetailId].push(sample);
        });
    
        output += `**Sample Summary by Tissue:**\n`;
        Object.entries(tissueGroups).forEach(([tissueId, tissueSamples]) => {
          const tissueDisplayName = this.getTissueDisplayName(tissueId);
          const maleCount = tissueSamples.filter(s => s.sex === 'male').length;
          const femaleCount = tissueSamples.filter(s => s.sex === 'female').length;
          const avgAge = this.calculateAverageAge(tissueSamples);
          
          output += `  **${tissueDisplayName}** (${tissueSamples.length} samples)\n`;
          output += `    • Male: ${maleCount}, Female: ${femaleCount}\n`;
          if (avgAge) {
            output += `    • Average age: ${avgAge}\n`;
          }
        });
      }
    
      if (result.paging_info && result.paging_info.totalNumberOfItems > samples.length) {
        output += `\n**Note:** Showing ${samples.length} of ${result.paging_info.totalNumberOfItems} total results.\n`;
      }
    
      return {
        content: [{
          type: "text",
          text: output.trim()
        }]
      };
    }
  • Input schema definition for the get_sample_info tool in the tools list returned by ListToolsRequestSchema.
      name: "get_sample_info",
      description: "Get GTEx sample metadata and demographics",
      inputSchema: {
        type: "object",
        properties: {
          tissueSiteDetailId: {
            type: "string",
            description: "Tissue site detail ID (optional, for tissue-specific samples)"
          },
          datasetId: {
            type: "string", 
            description: "GTEx dataset ID (default: gtex_v8)",
            default: "gtex_v8"
          }
        }
      }
    },
  • src/index.ts:739-744 (registration)
    Dispatch registration in the CallToolRequestSchema handler that routes get_sample_info calls to the referenceHandlers.getSamples method.
    if (name === "get_sample_info") {
      return await referenceHandlers.getSamples({
        tissueIds: args?.tissueSiteDetailId ? [args.tissueSiteDetailId] : undefined,
        datasetId: args?.datasetId
      });
    }
  • src/index.ts:23-44 (registration)
    Import and instantiation of ReferenceHandlers class used for get_sample_info tool execution.
    import { ReferenceHandlers } from "./handlers/reference-handlers.js";
    import { GTExApiClient } from "./utils/api-client.js";
    
    /**
     * Create an MCP server for GTEx Portal API access
     */
    const server = new Server(
      {
        name: "gtex-server",
        version: "1.0.0",
      },
      {
        capabilities: {
          tools: {},
        },
      }
    );
    
    // Initialize handlers (they create their own API clients internally)
    const expressionHandlers = new ExpressionHandlers();
    const associationHandlers = new AssociationHandlers();
    const referenceHandlers = new ReferenceHandlers();
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 it's a 'Get' operation, implying read-only, but doesn't clarify aspects like rate limits, authentication needs, or what happens if parameters are omitted. For a tool with no annotations, this leaves significant behavioral gaps.

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 no wasted words. It's front-loaded with the core purpose, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no annotations and no output schema, the description is minimal but covers the basic purpose. However, for a tool that likely returns complex metadata, more context on output format or behavior would be helpful. It's adequate but leaves room for improvement in completeness.

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 input schema has 100% description coverage, so the schema already documents both parameters thoroughly. The description doesn't add any semantic details beyond what's in the schema, such as explaining the relationship between tissueSiteDetailId and datasetId or typical use cases. Baseline 3 is appropriate when schema coverage is high.

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 the resource ('GTEx sample metadata and demographics'), which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_subject_phenotypes' or 'get_tissue_info', which might overlap in retrieving sample-related data.

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 context, prerequisites, or exclusions, leaving the agent to infer usage from the tool name and parameters alone.

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