Skip to main content
Glama

search_proteins

Search the UniProt database for proteins using names, keywords, or organism filters to retrieve detailed protein information in multiple formats.

Instructions

Search UniProt database for proteins by name, keyword, or organism

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (protein name, keyword, or complex search)
organismNoOrganism name or taxonomy ID to filter results
sizeNoNumber of results to return (1-500, default: 25)
formatNoOutput format (default: json)

Implementation Reference

  • Handler function that executes the search_proteins tool. Validates input, constructs UniProt search query with optional organism filter, calls the UniProt REST API, and returns JSON results or error.
    private async handleSearchProteins(args: any) { if (!isValidSearchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid search arguments'); } try { let query = args.query; if (args.organism) { query += ` AND organism_name:"${args.organism}"`; } const response = await this.apiClient.get('/uniprotkb/search', { params: { query: query, format: args.format || 'json', size: args.size || 25, }, }); return { content: [ { type: 'text', text: typeof response.data === 'object' ? JSON.stringify(response.data, null, 2) : String(response.data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error searching proteins: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
  • src/index.ts:400-412 (registration)
    Registration of the search_proteins tool in the ListToolsRequestSchema handler, including name, description, and input schema definition.
    { name: 'search_proteins', description: 'Search UniProt database for proteins by name, keyword, or organism', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query (protein name, keyword, or complex search)' }, organism: { type: 'string', description: 'Organism name or taxonomy ID to filter results' }, size: { type: 'number', description: 'Number of results to return (1-500, default: 25)', minimum: 1, maximum: 500 }, format: { type: 'string', enum: ['json', 'tsv', 'fasta', 'xml'], description: 'Output format (default: json)' }, }, required: ['query'], },
  • src/index.ts:728-729 (registration)
    Dispatch/registration in the CallToolRequestSchema switch statement that routes calls to the handleSearchProteins handler.
    case 'search_proteins': return this.handleSearchProteins(args);
  • Type guard function for validating input arguments to the search_proteins tool, matching the inputSchema.
    const isValidSearchArgs = ( args: any ): args is { query: string; organism?: string; size?: number; format?: string } => { return ( typeof args === 'object' && args !== null && typeof args.query === 'string' && (args.organism === undefined || typeof args.organism === 'string') && (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 500)) && (args.format === undefined || ['json', 'tsv', 'fasta', 'xml'].includes(args.format)) ); };

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/UniProt-MCP-Server'

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