export_for_chimerax
Export AlphaFold protein structure data for visualization in ChimeraX. Specify UniProt ID and optionally include confidence score coloring for enhanced analysis.
Instructions
Export structure data formatted for ChimeraX visualization
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeConfidence | No | Include confidence score coloring (default: true) | |
| uniprotId | Yes | UniProt accession |
Implementation Reference
- src/index.ts:550-561 (registration)Tool registration and schema definition in the list of tools returned by ListToolsRequestSchema.{ name: 'export_for_chimerax', description: 'Export structure data formatted for ChimeraX visualization', inputSchema: { type: 'object', properties: { uniprotId: { type: 'string', description: 'UniProt accession' }, includeConfidence: { type: 'boolean', description: 'Include confidence score coloring (default: true)' }, }, required: ['uniprotId'], }, },
- src/index.ts:619-620 (registration)Tool dispatch/registration in the CallToolRequestSchema switch statement.case 'export_for_chimerax': return this.handleExportForChimeraX(args);
- src/index.ts:134-144 (schema)Input validation function for export tools, including export_for_chimerax.const isValidExportArgs = ( args: any ): args is { uniprotId: string; includeConfidence?: boolean } => { return ( typeof args === 'object' && args !== null && typeof args.uniprotId === 'string' && args.uniprotId.length > 0 && (args.includeConfidence === undefined || typeof args.includeConfidence === 'boolean') ); };
- src/index.ts:1621-1679 (handler)The core handler function implementing the export_for_chimerax tool logic, which fetches the structure and generates a ChimeraX visualization script.private async handleExportForChimeraX(args: any) { if (!isValidExportArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid ChimeraX export 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 includeConfidence = args.includeConfidence !== false; const chimeraScript = ` # ChimeraX script for AlphaFold structure ${args.uniprotId} open ${structure.pdbUrl} cartoon color bychain ${includeConfidence ? ` # Color by confidence scores # This would require the confidence data to be loaded ` : ''} view `; return { content: [ { type: 'text', text: JSON.stringify({ uniprotId: args.uniprotId, chimeraScript, structureUrl: structure.pdbUrl, instructions: 'Open ChimeraX and run the commands above', }, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error exporting for ChimeraX: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; }