Skip to main content
Glama
Augmented-Nature

STRING-db MCP Server

get_functional_enrichment

Analyze protein sets to identify overrepresented biological functions, pathways, and processes using STRING database enrichment analysis.

Instructions

Perform functional enrichment analysis on a set of proteins

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protein_idsYesList of protein identifiers
speciesNoSpecies name or NCBI taxonomy ID (default: 9606 for human)
background_string_identifiersNoBackground protein set for enrichment (optional)

Implementation Reference

  • The handler function that validates input, calls the STRING API enrichment endpoint, parses the TSV response, groups results by category, and returns formatted JSON output.
    private async handleGetFunctionalEnrichment(args: any) {
      if (!isValidEnrichmentArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid enrichment arguments');
      }
    
      try {
        const species = args.species || '9606';
    
        const params: any = {
          identifiers: args.protein_ids.join('%0d'),
          species: species,
          caller_identity: 'string-mcp-server',
        };
    
        if (args.background_string_identifiers) {
          params.background_string_identifiers = args.background_string_identifiers.join('%0d');
        }
    
        const response = await this.apiClient.get('/tsv/enrichment', { params });
    
        const enrichments = this.parseTsvData<EnrichmentTerm>(response.data);
    
        // Group by category
        const groupedEnrichments: Record<string, EnrichmentTerm[]> = {};
        enrichments.forEach(term => {
          if (!groupedEnrichments[term.category]) {
            groupedEnrichments[term.category] = [];
          }
          groupedEnrichments[term.category].push(term);
        });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                query_proteins: args.protein_ids,
                species: species,
                total_terms: enrichments.length,
                enrichment_categories: Object.keys(groupedEnrichments),
                enrichments: groupedEnrichments,
                significant_terms: enrichments.filter(term => term.pvalue_fdr < 0.05).length,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error performing functional enrichment: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • src/index.ts:337-349 (registration)
    Tool registration in the list of tools returned by ListToolsRequestSchema, including name, description, and input schema.
    {
      name: 'get_functional_enrichment',
      description: 'Perform functional enrichment analysis on a set of proteins',
      inputSchema: {
        type: 'object',
        properties: {
          protein_ids: { type: 'array', items: { type: 'string' }, description: 'List of protein identifiers' },
          species: { type: 'string', description: 'Species name or NCBI taxonomy ID (default: 9606 for human)' },
          background_string_identifiers: { type: 'array', items: { type: 'string' }, description: 'Background protein set for enrichment (optional)' },
        },
        required: ['protein_ids'],
      },
    },
  • JSON schema defining the input parameters for the get_functional_enrichment tool.
    inputSchema: {
      type: 'object',
      properties: {
        protein_ids: { type: 'array', items: { type: 'string' }, description: 'List of protein identifiers' },
        species: { type: 'string', description: 'Species name or NCBI taxonomy ID (default: 9606 for human)' },
        background_string_identifiers: { type: 'array', items: { type: 'string' }, description: 'Background protein set for enrichment (optional)' },
      },
      required: ['protein_ids'],
    },
  • Type guard function that validates the input arguments for the functional enrichment tool.
    const isValidEnrichmentArgs = (
      args: any
    ): args is { protein_ids: string[]; species?: string; background_string_identifiers?: string[] } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        Array.isArray(args.protein_ids) &&
        args.protein_ids.length > 0 &&
        args.protein_ids.every((id: any) => typeof id === 'string') &&
        (args.species === undefined || typeof args.species === 'string') &&
        (args.background_string_identifiers === undefined ||
         (Array.isArray(args.background_string_identifiers) &&
          args.background_string_identifiers.every((id: any) => typeof id === 'string')))
      );
    };
  • TypeScript interface defining the structure of enrichment term data returned from the STRING API.
    interface EnrichmentTerm {
      category: string;
      term: string;
      number_of_genes: number;
      number_of_genes_in_background: number;
      ncbiTaxonId: number;
      inputGenes: string;
      preferredNames: string;
      pvalue: number;
      pvalue_fdr: number;
      description: string;
    }
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. It states the action but lacks details on what 'functional enrichment analysis' entails (e.g., statistical methods, output format, computational cost, or potential side effects like data processing time). This is a significant gap for a tool with no structured safety or behavior hints.

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 directly states the tool's purpose without any fluff or redundancy. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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 complexity of 'functional enrichment analysis' (a bioinformatics task with statistical implications), no annotations, and no output schema, the description is incomplete. It fails to explain what the analysis returns, how results are structured, or any prerequisites (e.g., valid protein ID formats), leaving critical gaps for effective tool 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 already documents all parameters thoroughly. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain what 'functional enrichment' means in terms of the parameters or how they interact). Baseline 3 is appropriate as the schema does the heavy lifting.

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 ('perform functional enrichment analysis') and target ('on a set of proteins'), which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_protein_annotations' or 'search_proteins', which might also involve protein analysis but for different purposes.

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 'get_protein_annotations' for annotation retrieval or 'search_proteins' for querying, leaving the agent to infer usage based on context 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/STRING-db-MCP-Server'

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