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
| Name | Required | Description | Default |
|---|---|---|---|
| accession | Yes | UniProt accession number |
Implementation Reference
- src/index.ts:1361-1398 (handler)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);
- src/index.ts:79-89 (helper)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)) ); };