get_prediction_metadata
Retrieve metadata for protein structure predictions, including version, date, and quality metrics, using a UniProt accession ID. Powered by the AlphaFold MCP Server.
Instructions
Get metadata about the prediction including version, date, and quality metrics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uniprotId | Yes | UniProt accession |
Implementation Reference
- src/index.ts:1055-1117 (handler)The handler function that implements the core logic of the get_prediction_metadata tool. It validates the uniprotId input, fetches the prediction data from the AlphaFold API, extracts relevant metadata (entry ID, versions, dates, coverage, URLs), and returns it as formatted JSON or an error message.private async handleGetPredictionMetadata(args: any) { if (!isValidUniProtArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid prediction metadata arguments'); } try { const response = await this.apiClient.get(`/prediction/${args.uniprotId}`); const structures = response.data; if (!structures || structures.length === 0) { return { content: [ { type: 'text', text: `No structure available for ${args.uniprotId}`, }, ], }; } const structure = structures[0]; const metadata = { entryId: structure.entryId, uniprotAccession: structure.uniprotAccession, modelCreatedDate: structure.modelCreatedDate, latestVersion: structure.latestVersion, allVersions: structure.allVersions, organism: structure.organismScientificName, sequenceLength: structure.uniprotSequence.length, coverage: { start: structure.uniprotStart, end: structure.uniprotEnd, percentage: ((structure.uniprotEnd - structure.uniprotStart + 1) / structure.uniprotSequence.length) * 100, }, urls: { pdb: structure.pdbUrl, cif: structure.cifUrl, bcif: structure.bcifUrl, paeImage: structure.paeImageUrl, paeDoc: structure.paeDocUrl, }, }; return { content: [ { type: 'text', text: JSON.stringify(metadata, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching prediction metadata: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:446-452 (schema)Input schema definition for the get_prediction_metadata tool, specifying that a uniprotId string is required.inputSchema: { type: 'object', properties: { uniprotId: { type: 'string', description: 'UniProt accession' }, }, required: ['uniprotId'], },
- src/index.ts:597-598 (registration)Registration of the tool handler in the CallToolRequestSchema switch statement, dispatching tool calls to the specific handleGetPredictionMetadata method.case 'get_prediction_metadata': return this.handleGetPredictionMetadata(args);
- src/index.ts:444-453 (registration)Tool registration entry in the ListToolsRequestSchema response, defining the name, description, and input schema for get_prediction_metadata.name: 'get_prediction_metadata', description: 'Get metadata about the prediction including version, date, and quality metrics', inputSchema: { type: 'object', properties: { uniprotId: { type: 'string', description: 'UniProt accession' }, }, required: ['uniprotId'], }, },
- src/index.ts:58-68 (helper)Helper validation function used by the get_prediction_metadata handler (and others) to validate UniProt ID arguments.const isValidUniProtArgs = ( args: any ): args is { uniprotId: string; format?: 'pdb' | 'cif' | 'bcif' | 'json' } => { return ( typeof args === 'object' && args !== null && typeof args.uniprotId === 'string' && args.uniprotId.length > 0 && (args.format === undefined || ['pdb', 'cif', 'bcif', 'json'].includes(args.format)) ); };