get_protein_interactions
Identify direct interaction partners of a protein using its gene name, UniProt ID, or STRING ID. Specify species, interaction confidence score, and limit results for precise protein network analysis within the STRING-db MCP Server.
Instructions
Get direct interaction partners for a specific protein
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of interactions to return (default: 10) | |
| protein_id | Yes | Protein identifier (gene name, UniProt ID, or STRING ID) | |
| required_score | No | Minimum interaction confidence score (0-1000, default: 400) | |
| species | No | Species name or NCBI taxonomy ID (default: 9606 for human) |
Implementation Reference
- src/index.ts:459-517 (handler)Core handler implementing the tool: validates input, queries STRING API /tsv/interaction_partners, parses TSV to ProteinInteraction objects, formats and returns JSON with interactions 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, }; } }
- src/index.ts:311-320 (schema)Input JSON Schema for the tool defining parameters: protein_id (required string), optional species (string), limit (number 1-2000), required_score (number 0-1000).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:308-321 (registration)Registration of the tool 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'], }, },
- src/index.ts:395-396 (registration)Dispatch registration in the CallToolRequestSchema switch statement, routing calls to the handler.case 'get_protein_interactions': return this.handleGetProteinInteractions(args);
- src/index.ts:69-81 (helper)Type guard helper function for validating input arguments matching the tool schema.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)) ); };