search_structures
Find AlphaFold protein structures by entering a protein or gene name. Filter results by organism and limit the number of outputs for targeted searches.
Instructions
Search for available AlphaFold structures by protein name or gene
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| organism | No | Filter by organism (optional) | |
| query | Yes | Search term (protein name, gene name, etc.) | |
| size | No | Number of results (1-100, default: 25) |
Implementation Reference
- src/index.ts:783-821 (handler)The main handler function that executes the 'search_structures' tool. It validates input arguments, constructs search parameters, calls the AlphaFold API search endpoint, and returns the results or handles errors.private async handleSearchStructures(args: any) { if (!isValidSearchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid search arguments'); } try { // Note: The actual AlphaFold API might have different search endpoints // This is a simulation of how it would work const params: any = { q: args.query, size: args.size || 25, }; if (args.organism) { params.organism = args.organism; } const response = await this.apiClient.get('/search', { params }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error searching structures: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:70-81 (schema)Type guard and validation function for the input arguments of the search_structures tool, ensuring query is a non-empty string and optional organism/size parameters are valid.const isValidSearchArgs = ( args: any ): args is { query: string; organism?: string; size?: number } => { return ( typeof args === 'object' && args !== null && typeof args.query === 'string' && args.query.length > 0 && (args.organism === undefined || typeof args.organism === 'string') && (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 100)) ); };
- src/index.ts:383-395 (registration)Tool registration in the ListToolsRequestSchema response, defining the name, description, and input schema for 'search_structures'.{ name: 'search_structures', description: 'Search for available AlphaFold structures by protein name or gene', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search term (protein name, gene name, etc.)' }, organism: { type: 'string', description: 'Filter by organism (optional)' }, size: { type: 'number', description: 'Number of results (1-100, default: 25)', minimum: 1, maximum: 100 }, }, required: ['query'], }, },
- src/index.ts:586-587 (registration)Registration of the tool handler in the CallToolRequestSchema switch statement, routing calls to search_structures to the handleSearchStructures method.case 'search_structures': return this.handleSearchStructures(args);
- src/index.ts:386-394 (schema)JSON schema definition for the input parameters of the search_structures tool.inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search term (protein name, gene name, etc.)' }, organism: { type: 'string', description: 'Filter by organism (optional)' }, size: { type: 'number', description: 'Number of results (1-100, default: 25)', minimum: 1, maximum: 100 }, }, required: ['query'], },