Skip to main content
Glama
Augmented-Nature

STRING-db MCP Server

get_protein_interactions

Retrieve direct interaction partners for a protein to analyze protein networks and functional relationships using the STRING database.

Instructions

Get direct interaction partners for a specific protein

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
protein_idYesProtein identifier (gene name, UniProt ID, or STRING ID)
speciesNoSpecies name or NCBI taxonomy ID (default: 9606 for human)
limitNoMaximum number of interactions to return (default: 10)
required_scoreNoMinimum interaction confidence score (0-1000, default: 400)

Implementation Reference

  • The main handler function that executes the tool logic: validates input, calls STRING API /tsv/interaction_partners, parses TSV data into ProteinInteraction objects, formats response as JSON with interaction details and evidence scores.
    private async handleGetProteinInteractions(args: any) {
      if (!isValidProteinArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid protein interaction arguments');
      }
    
      try {
        const species = args.species || '9606';
        const limit = args.limit || 10;
        const requiredScore = args.required_score || 400;
    
        const response = await this.apiClient.get('/tsv/interaction_partners', {
          params: {
            identifiers: args.protein_id,
            species: species,
            limit: limit,
            required_score: requiredScore,
          },
        });
    
        const interactions = this.parseTsvData<ProteinInteraction>(response.data);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                query_protein: args.protein_id,
                species: species,
                total_interactions: interactions.length,
                interactions: interactions.map(int => ({
                  partner_protein: int.preferredName_B,
                  string_id: int.stringId_B,
                  confidence_score: int.score,
                  evidence_scores: {
                    neighborhood: int.nscore,
                    fusion: int.fscore,
                    cooccurrence: int.pscore,
                    coexpression: int.ascore,
                    experimental: int.escore,
                    database: int.dscore,
                    textmining: int.tscore,
                  }
                }))
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error fetching protein interactions: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the tool, specifying required protein_id and optional parameters for species, limit, and minimum score.
    inputSchema: {
      type: 'object',
      properties: {
        protein_id: { type: 'string', description: 'Protein identifier (gene name, UniProt ID, or STRING ID)' },
        species: { type: 'string', description: 'Species name or NCBI taxonomy ID (default: 9606 for human)' },
        limit: { type: 'number', description: 'Maximum number of interactions to return (default: 10)', minimum: 1, maximum: 2000 },
        required_score: { type: 'number', description: 'Minimum interaction confidence score (0-1000, default: 400)', minimum: 0, maximum: 1000 },
      },
      required: ['protein_id'],
    },
  • src/index.ts:395-396 (registration)
    Tool registration in the CallToolRequestSchema switch statement, dispatching to the handler function.
    case 'get_protein_interactions':
      return this.handleGetProteinInteractions(args);
  • src/index.ts:309-321 (registration)
    Tool registration in the ListToolsRequestSchema response, including name, description, and input schema.
      name: 'get_protein_interactions',
      description: 'Get direct interaction partners for a specific protein',
      inputSchema: {
        type: 'object',
        properties: {
          protein_id: { type: 'string', description: 'Protein identifier (gene name, UniProt ID, or STRING ID)' },
          species: { type: 'string', description: 'Species name or NCBI taxonomy ID (default: 9606 for human)' },
          limit: { type: 'number', description: 'Maximum number of interactions to return (default: 10)', minimum: 1, maximum: 2000 },
          required_score: { type: 'number', description: 'Minimum interaction confidence score (0-1000, default: 400)', minimum: 0, maximum: 1000 },
        },
        required: ['protein_id'],
      },
    },
  • Type guard function for validating input arguments to the get_protein_interactions tool.
    const isValidProteinArgs = (
      args: any
    ): args is { protein_id: string; species?: string; limit?: number; required_score?: number } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.protein_id === 'string' &&
        args.protein_id.length > 0 &&
        (args.species === undefined || typeof args.species === 'string') &&
        (args.limit === undefined || (typeof args.limit === 'number' && args.limit > 0 && args.limit <= 2000)) &&
        (args.required_score === undefined || (typeof args.required_score === 'number' && args.required_score >= 0 && args.required_score <= 1000))
      );
    };

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