query_ontology_type
Retrieve objects of a specific ontology type by applying filter conditions to query Foundry datasets.
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 is decorated with @mcp.tool() which also serves as the registration. The function parameters include Pydantic Field descriptions that define the input schema. It retrieves objects from the Foundry ontology using the provided where filter and object_type.@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
- Input schema defined via Pydantic Field in the tool function signature.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.)")
- src/mcp_server_foundry/server.py:67-67 (registration)The @mcp.tool() decorator registers the function as an MCP tool.@mcp.tool()