Skip to main content
Glama

compare_structures

Compare multiple AlphaFold protein structures by inputting UniProt IDs to analyze and identify structural differences. Supports 2 to 10 IDs for detailed comparison.

Instructions

Compare multiple AlphaFold structures for analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uniprotIdsYesArray of UniProt accessions to compare (2-10)

Implementation Reference

  • The handler function that executes the 'compare_structures' tool. It validates input, fetches AlphaFold structure data for each UniProt ID, compiles comparison data (entryId, gene, organism, sequence length, coverage percentage, model date), handles errors per ID, and returns a JSON summary.
    private async handleCompareStructures(args: any) { if (!isValidCompareArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid compare structures arguments'); } try { const comparisons = []; for (const uniprotId of args.uniprotIds) { try { const response = await this.apiClient.get(`/prediction/${uniprotId}`); const structures = response.data; if (structures && structures.length > 0) { const structure = structures[0]; comparisons.push({ uniprotId, entryId: structure.entryId, gene: structure.gene, organism: structure.organismScientificName, sequenceLength: structure.uniprotSequence.length, coverage: ((structure.uniprotEnd - structure.uniprotStart + 1) / structure.uniprotSequence.length) * 100, modelCreatedDate: structure.modelCreatedDate, }); } else { comparisons.push({ uniprotId, error: 'No structure found', }); } } catch (error) { comparisons.push({ uniprotId, error: error instanceof Error ? error.message : 'Unknown error', }); } } return { content: [ { type: 'text', text: JSON.stringify({ structureComparison: comparisons }, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error comparing structures: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
  • src/index.ts:491-501 (registration)
    Registration of the 'compare_structures' tool in the ListTools response, including name, description, and input schema definition.
    { name: 'compare_structures', description: 'Compare multiple AlphaFold structures for analysis', inputSchema: { type: 'object', properties: { uniprotIds: { type: 'array', items: { type: 'string' }, description: 'Array of UniProt accessions to compare (2-10)', minItems: 2, maxItems: 10 }, }, required: ['uniprotIds'], }, },
  • src/index.ts:607-608 (registration)
    Handler dispatch in the CallToolRequest switch statement that routes 'compare_structures' calls to the implementation method.
    case 'compare_structures': return this.handleCompareStructures(args);
  • Input validation type guard for 'compare_structures' tool arguments, ensuring uniprotIds is a non-empty array of 2-10 valid strings.
    const isValidCompareArgs = ( args: any ): args is { uniprotIds: string[] } => { return ( typeof args === 'object' && args !== null && Array.isArray(args.uniprotIds) && args.uniprotIds.length >= 2 && args.uniprotIds.length <= 10 && args.uniprotIds.every((id: any) => typeof id === 'string' && id.length > 0) ); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Augmented-Nature/AlphaFold-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server