Skip to main content
Glama

search_by_gene

Find proteins by entering a gene name or symbol. Filter results by organism and set the number of results returned for precise research on the UniProt MCP Server.

Instructions

Search for proteins by gene name or symbol

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
geneYesGene name or symbol (e.g., BRCA1, INS)
organismNoOrganism name or taxonomy ID to filter results
sizeNoNumber of results to return (1-500, default: 25)

Implementation Reference

  • The main handler function for the 'search_by_gene' tool. It validates input, constructs a UniProt search query using the gene name (e.g., gene:"GENE") with optional organism filter, calls the UniProt API, and returns the JSON results or error.
    private async handleSearchByGene(args: any) { if (!isValidGeneSearchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid gene search arguments'); } try { let query = `gene:"${args.gene}"`; if (args.organism) { query += ` AND organism_name:"${args.organism}"`; } const response = await this.apiClient.get('/uniprotkb/search', { params: { query: query, format: 'json', size: args.size || 25, }, }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error searching by gene: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; }
  • Input schema definition for the 'search_by_gene' tool, specifying parameters: gene (required string), organism (optional string), size (optional number 1-500).
    inputSchema: { type: 'object', properties: { gene: { type: 'string', description: 'Gene name or symbol (e.g., BRCA1, INS)' }, 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 }, }, required: ['gene'],
  • src/index.ts:732-733 (registration)
    Registration of the 'search_by_gene' tool in the CallToolRequestSchema handler switch statement, dispatching to the handler function.
    case 'search_by_gene': return this.handleSearchByGene(args);
  • Type guard and validation function for input arguments of the 'search_by_gene' tool, used in the handler.
    const isValidGeneSearchArgs = ( args: any ): args is { gene: string; organism?: string; size?: number } => { return ( typeof args === 'object' && args !== null && typeof args.gene === 'string' && (args.organism === undefined || typeof args.organism === 'string') && (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 500)) ); };
  • src/index.ts:427-437 (registration)
    Tool metadata registration including name, description, and schema in the ListToolsRequestSchema response.
    name: 'search_by_gene', description: 'Search for proteins by gene name or symbol', inputSchema: { type: 'object', properties: { gene: { type: 'string', description: 'Gene name or symbol (e.g., BRCA1, INS)' }, 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 }, }, required: ['gene'], },

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