Skip to main content
Glama

get_protein_interactions

Retrieve protein-protein interaction networks for a UniProt accession number to analyze molecular relationships and biological pathways.

Instructions

Protein-protein interaction networks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accessionYesUniProt accession number

Implementation Reference

  • The handler function for the 'get_protein_interactions' tool. Fetches detailed protein information from the UniProt API and extracts relevant interaction data including cross-references to STRING and IntAct databases, as well as INTERACTION and SUBUNIT comments.
    private async handleGetProteinInteractions(args: any) {
      if (!isValidProteinInfoArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid protein interactions arguments');
      }
    
      try {
        const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, {
          params: { format: 'json' },
        });
    
        const protein = response.data;
        const interactionInfo = {
          accession: protein.primaryAccession,
          stringReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'STRING') || [],
          intactReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'IntAct') || [],
          interactionComments: protein.comments?.filter((c: any) => c.commentType === 'INTERACTION') || [],
          subunitComments: protein.comments?.filter((c: any) => c.commentType === 'SUBUNIT') || [],
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(interactionInfo, 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:570-579 (registration)
    Registration of the 'get_protein_interactions' tool in the listTools response, including name, description, and input schema definition.
      name: 'get_protein_interactions',
      description: 'Protein-protein interaction networks',
      inputSchema: {
        type: 'object',
        properties: {
          accession: { type: 'string', description: 'UniProt accession number' },
        },
        required: ['accession'],
      },
    },
  • src/index.ts:759-760 (registration)
    Registration of the tool handler in the CallToolRequestSchema switch statement, mapping the tool name to its handler method.
    case 'get_protein_interactions':
      return this.handleGetProteinInteractions(args);
  • Input validation function used by the handler to validate arguments, effectively serving as schema enforcement for the tool's input.
    const isValidProteinInfoArgs = (
      args: any
    ): args is { accession: string; format?: string } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.accession === 'string' &&
        args.accession.length > 0 &&
        (args.format === undefined || ['json', 'tsv', 'fasta', 'xml'].includes(args.format))
      );
    };

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/UniProt-MCP-Server'

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