Skip to main content
Glama
Augmented-Nature

STRING-db MCP Server

get_interaction_network

Build and analyze protein interaction networks for multiple proteins using the STRING database to identify functional or physical relationships between proteins.

Instructions

Build and analyze protein interaction network for multiple proteins

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protein_idsYesList of protein identifiers
speciesNoSpecies name or NCBI taxonomy ID (default: 9606 for human)
network_typeNoType of network to build (default: functional)
add_nodesNoNumber of additional interacting proteins to add (default: 0)
required_scoreNoMinimum interaction confidence score (0-1000, default: 400)

Implementation Reference

  • The primary handler function that implements the logic for the 'get_interaction_network' tool. It validates arguments, queries the STRING API for network interactions and node data, parses the TSV responses, computes network statistics, and returns a structured JSON response with nodes and edges.
    private async handleGetInteractionNetwork(args: any) {
      if (!isValidNetworkArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid network arguments');
      }
    
      try {
        const species = args.species || '9606';
        const addNodes = args.add_nodes || 0;
        const requiredScore = args.required_score || 400;
    
        // Get network data
        const networkResponse = await this.apiClient.get('/tsv/network', {
          params: {
            identifiers: args.protein_ids.join('%0d'),
            species: species,
            add_white_nodes: addNodes,
            required_score: requiredScore,
          },
        });
    
        const interactions = this.parseTsvData<ProteinInteraction>(networkResponse.data);
    
        // Get node annotations
        const nodeResponse = await this.apiClient.get('/tsv/get_string_ids', {
          params: {
            identifiers: args.protein_ids.join('%0d'),
            species: species,
          },
        });
    
        const nodes = this.parseTsvData<NetworkNode>(nodeResponse.data);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                query_proteins: args.protein_ids,
                species: species,
                network_stats: {
                  total_nodes: nodes.length,
                  total_edges: interactions.length,
                  average_degree: interactions.length > 0 ? (interactions.length * 2) / nodes.length : 0,
                },
                nodes: nodes.map(node => ({
                  protein_name: node.preferredName,
                  string_id: node.stringId,
                  annotation: node.annotation,
                  protein_size: node.protein_size,
                })),
                edges: interactions.map(int => ({
                  protein_a: int.preferredName_A,
                  protein_b: int.preferredName_B,
                  confidence_score: int.score,
                  evidence_types: this.getEvidenceTypes(int),
                }))
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error building interaction network: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • The input schema and metadata definition for the 'get_interaction_network' tool, registered in the ListTools response.
    {
      name: 'get_interaction_network',
      description: 'Build and analyze protein interaction network for multiple 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)' },
          network_type: { type: 'string', enum: ['functional', 'physical'], description: 'Type of network to build (default: functional)' },
          add_nodes: { type: 'number', description: 'Number of additional interacting proteins to add (default: 0)', minimum: 0, maximum: 100 },
          required_score: { type: 'number', description: 'Minimum interaction confidence score (0-1000, default: 400)', minimum: 0, maximum: 1000 },
        },
        required: ['protein_ids'],
      },
    },
  • src/index.ts:397-398 (registration)
    Registration in the CallToolRequestHandler switch statement that dispatches tool calls to the appropriate handler.
    case 'get_interaction_network':
      return this.handleGetInteractionNetwork(args);
  • Helper function for validating the input arguments specific to the network tool.
    const isValidNetworkArgs = (
      args: any
    ): args is { protein_ids: string[]; species?: string; network_type?: string; add_nodes?: number; required_score?: number } => {
      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.network_type === undefined || ['functional', 'physical'].includes(args.network_type)) &&
        (args.add_nodes === undefined || (typeof args.add_nodes === 'number' && args.add_nodes >= 0 && args.add_nodes <= 100)) &&
        (args.required_score === undefined || (typeof args.required_score === 'number' && args.required_score >= 0 && args.required_score <= 1000))
      );
  • Utility function to parse TSV data from STRING API responses into typed objects, heavily used in the handler.
    private parseTsvData<T>(tsvData: string): T[] {
      const lines = tsvData.trim().split('\n');
      if (lines.length < 2) return [];
    
      const headers = lines[0].split('\t');
      const results: T[] = [];
    
      for (let i = 1; i < lines.length; i++) {
        const values = lines[i].split('\t');
        const obj: any = {};
    
        headers.forEach((header, index) => {
          const value = values[index] || '';
          // Convert numeric fields
          if (['score', 'nscore', 'fscore', 'pscore', 'ascore', 'escore', 'dscore', 'tscore',
               'ncbiTaxonId', 'protein_size', 'number_of_genes', 'number_of_genes_in_background',
               'pvalue', 'pvalue_fdr'].includes(header)) {
            obj[header] = parseFloat(value) || 0;
          } else {
            obj[header] = value;
          }
        });
    
        results.push(obj as T);
      }
    
      return results;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'build and analyze' which implies computational processing, but doesn't disclose important traits like computational intensity, timeout risks, data source limitations, or what 'analyze' specifically entails (e.g., returns network statistics, visualizations, or raw edges). For a network construction tool with 5 parameters, 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 perfectly concise - a single sentence that states the core purpose without any redundant words. It's front-loaded with the essential action ('build and analyze') and resource ('protein interaction network'). Every word earns its place, 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 network construction/analysis, 5 parameters, no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what 'analyze' produces (network properties? visualization? edge list?), doesn't mention data sources or limitations, and provides no context about computational requirements. For a tool that likely returns complex network data, this leaves too many unknowns.

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 5 parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema - it doesn't explain relationships between parameters (e.g., how 'add_nodes' interacts with 'required_score') or provide usage examples. With complete schema coverage, baseline 3 is appropriate as the description doesn't enhance parameter understanding.

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 with specific verbs ('build and analyze') and resource ('protein interaction network for multiple proteins'). It distinguishes from sibling tools like 'get_protein_interactions' by emphasizing network construction and analysis rather than just retrieving interactions. However, it doesn't explicitly differentiate from all siblings like 'get_functional_enrichment' which might also involve network analysis.

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_interactions' (which might retrieve individual interactions) or 'get_functional_enrichment' (which might analyze network properties). There's no context about prerequisites, typical use cases, or limitations that would help an agent choose between available options.

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