export_protein_data
Export protein data from UniProt in specialized formats like GFF, GenBank, EMBL, or XML for analysis and integration.
Instructions
Export data in specialized formats (GFF, GenBank, etc.)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accession | Yes | UniProt accession number | |
| format | Yes | Export format |
Implementation Reference
- src/index.ts:1821-1850 (handler)The main handler function for the 'export_protein_data' tool. It validates input using isValidProteinInfoArgs, fetches protein data from UniProt API in the specified format (gff, genbank, embl, xml), and returns the data as text content.
private async handleExportProteinData(args: any) { if (!isValidProteinInfoArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid export protein data arguments'); } try { const response = await this.apiClient.get(`/uniprotkb/${args.accession}`, { params: { format: args.format }, }); return { content: [ { type: 'text', text: String(response.data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error exporting protein data: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } } - src/index.ts:780-781 (registration)Dispatch case in the CallToolRequestSchema handler that routes calls to the export_protein_data tool to its handler function.
case 'export_protein_data': return this.handleExportProteinData(args); - src/index.ts:687-697 (schema)Tool registration and input schema definition in the ListToolsRequestSchema response. Defines the tool name, description, and input schema requiring accession and format.
name: 'export_protein_data', description: 'Export data in specialized formats (GFF, GenBank, etc.)', inputSchema: { type: 'object', properties: { accession: { type: 'string', description: 'UniProt accession number' }, format: { type: 'string', enum: ['gff', 'genbank', 'embl', 'xml'], description: 'Export format' }, }, required: ['accession', 'format'], }, }, - src/index.ts:79-89 (helper)Input validation helper function used by the export_protein_data handler to validate arguments (accession required, format optional with limited enums). Note: enum includes xml but not all export formats; handler relies on API.
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)) ); };