query_ontology_type
Retrieve objects from a specific ontology type in Foundry datasets by applying filter conditions to locate relevant data entries.
Instructions
Query for objects in a given ontology type. Use list_ontology_types to get the list of available types
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| where | Yes | Filter conditions | |
| object_type | Yes | Name of a ontology type (e.g. User, Article, etc.) |
Implementation Reference
- src/mcp_server_foundry/server.py:67-95 (handler)The main handler function for the 'query_ontology_type' tool. It uses the FoundryClient to search for objects in the specified ontology type based on the 'where' filter, dynamically determining properties to select. The function parameters include Pydantic Field descriptions serving as input schema.@mcp.tool() def query_ontology_type( ctx: Context, where: dict[any, any] = Field(description="Filter conditions"), object_type: str = Field(description="Name of a ontology type (e.g. User, Article, etc.)") ) -> dict: """ Query for objects in a given ontology type. Use list_ontology_types to get the list of available types """ foundry_client: FoundryClient = ctx.request_context.lifespan_context.foundry_client ontology_id: str = ctx.request_context.lifespan_context.ontology_id all_properties = [prop for prop in foundry_client.ontologies.OntologyObject.list( ontology_id, object_type, page_size=1 ).data[0] if not prop.startswith('__') ] response = foundry_client.ontologies.OntologyObject.search( ontology_id, object_type, select=all_properties, exclude_rid=True, where=where ) return response.data