find_similar_terms
Identify related terms in biological and medical ontologies using LLM embeddings to expand search results and discover semantic connections.
Instructions
Find terms similar to the given term using LLM embeddings.
Args: term_iri: The IRI of the reference term ontology: The ontology identifier size: Maximum number of similar terms to return
Returns: JSON formatted list of similar terms
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| term_iri | Yes | ||
| ontology | Yes | ||
| size | No |
Implementation Reference
- src/ols_mcp_server/server.py:257-289 (handler)The handler function implementing the 'find_similar_terms' tool logic. It calls the OLS API endpoint /llm_similar to find similar terms based on LLM embeddings for the given term IRI in the specified ontology. Includes input schema via type annotations and docstring. Registered via @mcp.tool() decorator.@mcp.tool() async def find_similar_terms( term_iri: str, ontology: str, size: int = 10 ) -> str: """Find terms similar to the given term using LLM embeddings. Args: term_iri: The IRI of the reference term ontology: The ontology identifier size: Maximum number of similar terms to return Returns: JSON formatted list of similar terms """ encoded_iri = url_encode_iri(term_iri) params: dict[str, Any] = { "page": 0, "size": size } url = f"{OLS_BASE_URL}/api/v2/ontologies/{ontology}/classes/{encoded_iri}/llm_similar" try: response = await client.get(url, params=params) response.raise_for_status() data = response.json() return format_response(data, size) except httpx.HTTPError as e: return f"Error finding similar terms: {str(e)}"