Skip to main content
Glama

search_terms

Search and filter ontology terms across biological ontologies using customizable parameters like exact match, semantic types, and language preferences.

Instructions

Search across ontology terms with advanced filtering options

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
also_search_obsoleteNoInclude obsolete terms (default: false)
also_search_propertiesNoSearch in properties as well (default: false)
also_search_viewsNoInclude ontology views in search (default: false)
cuiNoComma-separated CUIs to filter by
includeNoComma-separated attributes to include (e.g., prefLabel,synonym,definition)
languageNoLanguage code (e.g., en, fr)
ontologiesNoComma-separated list of ontology acronyms to search in
pageNoPage number (default: 1)
pagesizeNoResults per page (default: 50, max: 500)
queryYesSearch query for ontology terms
require_definitionsNoOnly return terms with definitions (default: false)
require_exact_matchNoRequire exact match (default: false)
semantic_typesNoComma-separated semantic types to filter by
suggestNoEnable suggestion mode for type-ahead (default: false)

Implementation Reference

  • The main handler function for the 'search_terms' tool. Validates input arguments using isValidSearchTermsArgs, constructs query parameters for the BioOntology API /search endpoint, fetches results, and returns formatted JSON response or error content.
    private async handleSearchTerms(args: any) { if (!isValidSearchTermsArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid search terms arguments'); } try { const params: any = { q: args.query, apikey: this.apiKey, }; // Add optional parameters if (args.ontologies) params.ontologies = args.ontologies; if (args.require_exact_match !== undefined) params.require_exact_match = args.require_exact_match; if (args.suggest !== undefined) params.suggest = args.suggest; if (args.also_search_views !== undefined) params.also_search_views = args.also_search_views; if (args.require_definitions !== undefined) params.require_definitions = args.require_definitions; if (args.also_search_properties !== undefined) params.also_search_properties = args.also_search_properties; if (args.also_search_obsolete !== undefined) params.also_search_obsolete = args.also_search_obsolete; if (args.cui) params.cui = args.cui; if (args.semantic_types) params.semantic_types = args.semantic_types; if (args.include) params.include = args.include; if (args.page) params.page = args.page; if (args.pagesize) params.pagesize = args.pagesize; if (args.language) params.language = args.language; const response = await this.apiClient.get('/search', { params }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error searching terms: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
  • JSON Schema defining the structure and validation rules for input parameters of the 'search_terms' tool.
    type: 'object', properties: { query: { type: 'string', description: 'Search query for ontology terms' }, ontologies: { type: 'string', description: 'Comma-separated list of ontology acronyms to search in' }, require_exact_match: { type: 'boolean', description: 'Require exact match (default: false)' }, suggest: { type: 'boolean', description: 'Enable suggestion mode for type-ahead (default: false)' }, also_search_views: { type: 'boolean', description: 'Include ontology views in search (default: false)' }, require_definitions: { type: 'boolean', description: 'Only return terms with definitions (default: false)' }, also_search_properties: { type: 'boolean', description: 'Search in properties as well (default: false)' }, also_search_obsolete: { type: 'boolean', description: 'Include obsolete terms (default: false)' }, cui: { type: 'string', description: 'Comma-separated CUIs to filter by' }, semantic_types: { type: 'string', description: 'Comma-separated semantic types to filter by' }, include: { type: 'string', description: 'Comma-separated attributes to include (e.g., prefLabel,synonym,definition)' }, page: { type: 'number', description: 'Page number (default: 1)', minimum: 1 }, pagesize: { type: 'number', description: 'Results per page (default: 50, max: 500)', minimum: 1, maximum: 500 }, language: { type: 'string', description: 'Language code (e.g., en, fr)' }, }, required: ['query'],
  • src/index.ts:526-549 (registration)
    Registration of the 'search_terms' tool in the MCP server's ListTools response, including name, description, and input schema.
    { name: 'search_terms', description: 'Search across ontology terms with advanced filtering options', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for ontology terms' }, ontologies: { type: 'string', description: 'Comma-separated list of ontology acronyms to search in' }, require_exact_match: { type: 'boolean', description: 'Require exact match (default: false)' }, suggest: { type: 'boolean', description: 'Enable suggestion mode for type-ahead (default: false)' }, also_search_views: { type: 'boolean', description: 'Include ontology views in search (default: false)' }, require_definitions: { type: 'boolean', description: 'Only return terms with definitions (default: false)' }, also_search_properties: { type: 'boolean', description: 'Search in properties as well (default: false)' }, also_search_obsolete: { type: 'boolean', description: 'Include obsolete terms (default: false)' }, cui: { type: 'string', description: 'Comma-separated CUIs to filter by' }, semantic_types: { type: 'string', description: 'Comma-separated semantic types to filter by' }, include: { type: 'string', description: 'Comma-separated attributes to include (e.g., prefLabel,synonym,definition)' }, page: { type: 'number', description: 'Page number (default: 1)', minimum: 1 }, pagesize: { type: 'number', description: 'Results per page (default: 50, max: 500)', minimum: 1, maximum: 500 }, language: { type: 'string', description: 'Language code (e.g., en, fr)' }, }, required: ['query'], }, },
  • Helper validation function (type guard) that checks if arguments match the expected structure for 'search_terms' tool before handler execution.
    const isValidSearchTermsArgs = ( args: any ): args is { query: string; ontologies?: string; require_exact_match?: boolean; suggest?: boolean; also_search_views?: boolean; require_definitions?: boolean; also_search_properties?: boolean; also_search_obsolete?: boolean; cui?: string; semantic_types?: string; include?: string; page?: number; pagesize?: number; language?: string; } => { return ( typeof args === 'object' && args !== null && typeof args.query === 'string' && (args.ontologies === undefined || typeof args.ontologies === 'string') && (args.require_exact_match === undefined || typeof args.require_exact_match === 'boolean') && (args.suggest === undefined || typeof args.suggest === 'boolean') && (args.also_search_views === undefined || typeof args.also_search_views === 'boolean') && (args.require_definitions === undefined || typeof args.require_definitions === 'boolean') && (args.also_search_properties === undefined || typeof args.also_search_properties === 'boolean') && (args.also_search_obsolete === undefined || typeof args.also_search_obsolete === 'boolean') && (args.cui === undefined || typeof args.cui === 'string') && (args.semantic_types === undefined || typeof args.semantic_types === 'string') && (args.include === undefined || typeof args.include === 'string') && (args.page === undefined || (typeof args.page === 'number' && args.page > 0)) && (args.pagesize === undefined || (typeof args.pagesize === 'number' && args.pagesize > 0 && args.pagesize <= 500)) && (args.language === undefined || typeof args.language === 'string') ); };
  • src/index.ts:701-702 (registration)
    Dispatcher in CallToolRequestSchema handler that routes 'search_terms' tool calls to the handleSearchTerms method.
    case 'search_terms': return this.handleSearchTerms(args);

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

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