get_external_references
Retrieve cross-references from UniProt entries to external databases like PDB, EMBL, and RefSeq by providing an accession number.
Instructions
Links to other databases (PDB, EMBL, RefSeq, etc.)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"accession": "<accession>"
},
"name": "get_external_references"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accession | Yes | UniProt accession number |
Implementation Reference
- src/index.ts:1697-1737 (handler)The handler function for the 'get_external_references' tool. It validates the accession input, fetches the UniProtKB entry via API, extracts cross-references (uniProtKBCrossReferences), categorizes them by database (PDB, EMBL, RefSeq, Ensembl, GO), and returns structured JSON.
private async handleGetExternalReferences(args: any) { if (!isValidProteinInfoArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid external references arguments'); } try { const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, { params: { format: 'json' }, }); const protein = response.data; const externalRefs = { accession: protein.primaryAccession, allReferences: protein.uniProtKBCrossReferences || [], pdbReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'PDB') || [], emblReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'EMBL') || [], refseqReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'RefSeq') || [], ensemblReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'Ensembl') || [], goReferences: protein.uniProtKBCrossReferences?.filter((ref: any) => ref.database === 'GO') || [], }; return { content: [ { type: 'text', text: JSON.stringify(externalRefs, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching external references: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } } - src/index.ts:774-775 (registration)Registers and dispatches the 'get_external_references' tool call to its handler within the CallToolRequestSchema switch statement.
return this.handleGetExternalReferences(args); case 'get_literature_references': - src/index.ts:653-662 (schema)Tool metadata and input schema definition returned by ListToolsRequestSchema, specifying the name, description, and required 'accession' parameter.
name: 'get_external_references', description: 'Links to other databases (PDB, EMBL, RefSeq, etc.)', inputSchema: { type: 'object', properties: { accession: { type: 'string', description: 'UniProt accession number' }, }, required: ['accession'], }, }, - src/index.ts:79-89 (helper)Input validation helper function used by the get_external_references handler to validate the accession argument.
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)) ); };