Skip to main content
Glama

get_protein_pathways

Retrieve biological pathways (KEGG, Reactome) for a protein using its UniProt accession number to understand its functional context.

Instructions

Associated biological pathways (KEGG, Reactome)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accessionYesUniProt accession number

Implementation Reference

  • The handler function that implements the core logic of the 'get_protein_pathways' tool. It validates input, fetches detailed protein information from the UniProt REST API, extracts relevant pathway data (KEGG/Reactome cross-references and comments), formats it as JSON, and returns it.
    private async handleGetProteinPathways(args: any) {
      if (!isValidProteinInfoArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid protein pathways arguments');
      }
    
      try {
        const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, {
          params: { format: 'json' },
        });
    
        const protein = response.data;
        const pathwayInfo = {
          accession: protein.primaryAccession,
          keggReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'KEGG') || [],
          reactomeReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'Reactome') || [],
          pathwayComments: protein.comments?.filter((c: any) => c.commentType === 'PATHWAY') || [],
          biologicalProcess: protein.comments?.filter((c: any) => c.commentType === 'FUNCTION') || [],
        };
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(pathwayInfo, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error fetching protein pathways: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
  • src/index.ts:559-567 (registration)
    Registration of the 'get_protein_pathways' tool in the list of available tools, including its name, description, and input schema definition.
    name: 'get_protein_pathways',
    description: 'Associated biological pathways (KEGG, Reactome)',
    inputSchema: {
      type: 'object',
      properties: {
        accession: { type: 'string', description: 'UniProt accession number' },
      },
      required: ['accession'],
    },
  • src/index.ts:757-758 (registration)
    Dispatch registration in the CallToolRequestSchema switch statement that routes calls to the handler function.
    case 'get_protein_pathways':
      return this.handleGetProteinPathways(args);
  • Shared input validation helper function used by get_protein_pathways (and other protein info tools) to validate the accession parameter.
    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