search_ontologies
Search and explore over 1,200 biological ontologies by name, description, or domain. Filter results to include ontology views, JSON-LD context, and hypermedia links for comprehensive research and analysis.
Instructions
Search for ontologies by name, description, or domain
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| also_search_views | No | Include ontology views (default: false) | |
| display_context | No | Include JSON-LD context (default: true) | |
| display_links | No | Include hypermedia links (default: true) | |
| include_views | No | Include views in results (default: false) | |
| query | No | Search query for ontologies (optional for listing all) |
Implementation Reference
- src/index.ts:828-866 (handler)The main handler function that implements the logic for the 'search_ontologies' tool. It validates arguments, constructs API parameters, calls the BioOntology /ontologies endpoint, and returns the JSON response.private async handleSearchOntologies(args: any) { if (!isValidSearchOntologiesArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid search ontologies arguments'); } try { const params: any = { apikey: this.apiKey, }; // Add optional parameters if (args.query) params.q = args.query; if (args.also_search_views !== undefined) params.also_search_views = args.also_search_views; if (args.include_views !== undefined) params.include_views = args.include_views; if (args.display_context !== undefined) params.display_context = args.display_context; if (args.display_links !== undefined) params.display_links = args.display_links; const response = await this.apiClient.get('/ontologies', { params }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error searching ontologies: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:218-236 (schema)Input validation function specifically for 'search_ontologies' tool arguments, checking types for all optional parameters.const isValidSearchOntologiesArgs = ( args: any ): args is { query?: string; also_search_views?: boolean; include_views?: boolean; display_context?: boolean; display_links?: boolean; } => { return ( typeof args === 'object' && args !== null && (args.query === undefined || typeof args.query === 'string') && (args.also_search_views === undefined || typeof args.also_search_views === 'boolean') && (args.include_views === undefined || typeof args.include_views === 'boolean') && (args.display_context === undefined || typeof args.display_context === 'boolean') && (args.display_links === undefined || typeof args.display_links === 'boolean') ); };
- src/index.ts:570-584 (registration)Registration of the 'search_ontologies' tool in the MCP server's tool list, defining its name, description, and detailed input schema.{ name: 'search_ontologies', description: 'Search for ontologies by name, description, or domain', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for ontologies (optional for listing all)' }, also_search_views: { type: 'boolean', description: 'Include ontology views (default: false)' }, include_views: { type: 'boolean', description: 'Include views in results (default: false)' }, display_context: { type: 'boolean', description: 'Include JSON-LD context (default: true)' }, display_links: { type: 'boolean', description: 'Include hypermedia links (default: true)' }, }, required: [], }, },
- src/index.ts:705-706 (registration)Dispatch case in the tool call handler that routes 'search_ontologies' calls to the appropriate handler method.case 'search_ontologies': return this.handleSearchOntologies(args);