Skip to main content
Glama

search_go_terms

Search Gene Ontology terms by keyword, name, or definition to identify molecular functions, biological processes, or cellular components across datasets. Customize results with ontology filters, exact matches, and obsolete term inclusion.

Instructions

Search across Gene Ontology terms by keyword, name, or definition

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exactNoExact match only (default: false)
include_obsoleteNoInclude obsolete terms (default: false)
ontologyNoGO ontology to search (default: all)
queryYesSearch query (term name, keyword, or definition)
sizeNoNumber of results to return (1-500, default: 25)

Implementation Reference

  • The primary handler function for the 'search_go_terms' tool. It validates input arguments, constructs query parameters for the QuickGO API, fetches search results, processes them into a structured format with term details, and returns a JSON-formatted text content block or an error response.
    private async handleSearchGoTerms(args: any) { if (!isValidSearchArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid search arguments'); } try { const params: any = { query: args.query, limit: args.size || 25, page: 1, }; if (args.ontology && args.ontology !== 'all') { params.aspect = args.ontology === 'molecular_function' ? 'F' : args.ontology === 'biological_process' ? 'P' : 'C'; } if (args.include_obsolete === false) { params.obsolete = 'false'; } const response = await this.quickGoClient.get('/ontology/go/search', { params }); const searchResults = { query: args.query, totalResults: response.data.numberOfHits || 0, returnedResults: response.data.results?.length || 0, results: response.data.results?.map((term: any) => ({ id: term.id, name: term.name, definition: term.definition?.text || 'No definition available', namespace: term.aspect === 'F' ? 'molecular_function' : term.aspect === 'P' ? 'biological_process' : 'cellular_component', obsolete: term.isObsolete || false, url: `https://www.ebi.ac.uk/QuickGO/term/${term.id}` })) || [] }; return { content: [ { type: 'text', text: JSON.stringify(searchResults, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error searching GO terms: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
  • JSON Schema defining the input parameters for the 'search_go_terms' tool, specifying types, descriptions, constraints (e.g., size limits, ontology enum), and required fields.
    inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query (term name, keyword, or definition)' }, ontology: { type: 'string', enum: ['molecular_function', 'biological_process', 'cellular_component', 'all'], description: 'GO ontology to search (default: all)' }, size: { type: 'number', description: 'Number of results to return (1-500, default: 25)', minimum: 1, maximum: 500 }, exact: { type: 'boolean', description: 'Exact match only (default: false)' }, include_obsolete: { type: 'boolean', description: 'Include obsolete terms (default: false)' }, }, required: ['query'], },
  • src/index.ts:284-302 (registration)
    Tool registration entry in the ListToolsRequestSchema handler, defining the name, description, and input schema for 'search_go_terms'.
    { name: 'search_go_terms', description: 'Search across Gene Ontology terms by keyword, name, or definition', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query (term name, keyword, or definition)' }, ontology: { type: 'string', enum: ['molecular_function', 'biological_process', 'cellular_component', 'all'], description: 'GO ontology to search (default: all)' }, size: { type: 'number', description: 'Number of results to return (1-500, default: 25)', minimum: 1, maximum: 500 }, exact: { type: 'boolean', description: 'Exact match only (default: false)' }, include_obsolete: { type: 'boolean', description: 'Include obsolete terms (default: false)' }, }, required: ['query'], }, },
  • src/index.ts:343-344 (registration)
    Dispatcher case in the CallToolRequestSchema handler that routes 'search_go_terms' calls to the handleSearchGoTerms method.
    case 'search_go_terms': return this.handleSearchGoTerms(args);
  • Type guard and validation function specifically for 'search_go_terms' input arguments, used in the handler to ensure correct types and values before API call.
    const isValidSearchArgs = (args: any): args is { query: string; ontology?: string; size?: number; exact?: boolean; include_obsolete?: boolean; } => { return ( typeof args === 'object' && args !== null && typeof args.query === 'string' && args.query.length > 0 && (args.ontology === undefined || ['molecular_function', 'biological_process', 'cellular_component', 'all'].includes(args.ontology)) && (args.size === undefined || (typeof args.size === 'number' && args.size > 0 && args.size <= 500)) && (args.exact === undefined || typeof args.exact === 'boolean') && (args.include_obsolete === undefined || typeof args.include_obsolete === 'boolean') ); };

Other Tools

Related Tools

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

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