Skip to main content
Glama

search_proteins

Search the UniProt database for proteins by name, keyword, or organism, and retrieve results in JSON, TSV, FASTA, or XML formats.

Instructions

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

Input Schema

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

Implementation Reference

  • The core handler function that implements the 'search_proteins' tool logic. It validates the input arguments, constructs a search query for the UniProt API (optionally filtering by organism), fetches the results, and returns formatted JSON or handles errors.
    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, }; } }
  • The tool definition including name, description, and input schema registered in the ListTools response. Defines the expected input parameters and constraints for the search_proteins tool.
    { 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-730 (registration)
    Registers the handler for 'search_proteins' in the CallToolRequestSchema switch statement within setupToolHandlers.
    case 'search_proteins': return this.handleSearchProteins(args); case 'get_protein_info':
  • Type guard and validation function used by the handler to validate input arguments for the search_proteins tool.
    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