get_protein_pathways
Identify biological pathways (KEGG, Reactome) associated with a protein using its UniProt accession number to explore 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 get_protein_pathways tool. It validates the input accession, fetches the full protein entry from UniProt REST API, extracts KEGG/Reactome cross-references and pathway-related comments, and returns them as JSON.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:558-568 (registration)Tool registration in the ListTools response, including 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 of the tool handler in the CallToolRequest switch statement.case 'get_protein_pathways': return this.handleGetProteinPathways(args);
- src/index.ts:79-89 (schema)Input validation helper function used by get_protein_pathways 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)) ); };