Skip to main content
Glama

list_by_organism

Retrieve AlphaFold protein structures for a specific organism by entering its name. Specify the number of results to efficiently access relevant data.

Instructions

List all available structures for a specific organism

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
organismYesOrganism name (e.g., "Homo sapiens", "Escherichia coli")
sizeNoNumber of results (1-100, default: 50)

Implementation Reference

  • The handler function that implements the core logic for the 'list_by_organism' tool. Validates input, makes API call to AlphaFold /prediction endpoint with organism filter, returns JSON structures list or error.
    private async handleListByOrganism(args: any) {
      if (!isValidOrganismArgs(args)) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid organism arguments');
      }
    
      try {
        const response = await this.apiClient.get('/prediction', {
          params: {
            organism: args.organism,
            size: args.size || 50,
          },
        });
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error listing structures by organism: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • src/index.ts:397-407 (registration)
    Registration of the 'list_by_organism' tool in the tools list returned by ListToolsRequestHandler, defining name, description, and input schema.
      name: 'list_by_organism',
      description: 'List all available structures for a specific organism',
      inputSchema: {
        type: 'object',
        properties: {
          organism: { type: 'string', description: 'Organism name (e.g., "Homo sapiens", "Escherichia coli")' },
          size: { type: 'number', description: 'Number of results (1-100, default: 50)', minimum: 1, maximum: 100 },
        },
        required: ['organism'],
      },
    },
  • src/index.ts:588-589 (registration)
    Dispatch in the CallToolRequestHandler switch statement that routes calls to the list_by_organism handler function.
    case 'list_by_organism':
      return this.handleListByOrganism(args);
  • Helper validation function (type guard) used in the handler to validate input parameters for the list_by_organism tool.
    const isValidOrganismArgs = (
      args: any
    ): args is { organism: string; size?: number } => {
      return (
        typeof args === 'object' &&
        args !== null &&
        typeof args.organism === 'string' &&
        args.organism.length > 0 &&
        (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 100))
      );
    };

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