|
32 | 32 | from kiln_ai.utils.exhaustive_error import raise_exhaustive_enum_error |
33 | 33 | from kiln_server.project_api import project_from_id |
34 | 34 | from kiln_server.task_api import task_from_id |
35 | | -from kiln_server.utils.agent_checks.policy import ALLOW_AGENT, DENY_AGENT |
| 35 | +from kiln_server.utils.agent_checks.policy import ( |
| 36 | + ALLOW_AGENT, |
| 37 | + DENY_AGENT, |
| 38 | + agent_policy_require_approval, |
| 39 | +) |
36 | 40 | from mcp.types import Tool as MCPTool |
37 | 41 | from pydantic import BaseModel, Field |
38 | 42 |
|
@@ -818,7 +822,9 @@ def _validate_kiln_task_tool_task_and_run_config( |
818 | 822 | @app.post( |
819 | 823 | "/api/projects/{project_id}/kiln_task_tool", |
820 | 824 | tags=["Tools & MCP"], |
821 | | - openapi_extra=DENY_AGENT, |
| 825 | + openapi_extra=agent_policy_require_approval( |
| 826 | + "Register a Kiln task as a tool (also called a sub-agent), making it callable by other agents and run configs." |
| 827 | + ), |
822 | 828 | ) |
823 | 829 | async def add_kiln_task_tool( |
824 | 830 | project_id: Annotated[ |
@@ -852,7 +858,9 @@ async def add_kiln_task_tool( |
852 | 858 | @app.patch( |
853 | 859 | "/api/projects/{project_id}/edit_kiln_task_tool/{tool_server_id}", |
854 | 860 | tags=["Tools & MCP"], |
855 | | - openapi_extra=DENY_AGENT, |
| 861 | + openapi_extra=agent_policy_require_approval( |
| 862 | + "Edit a Kiln task tool (also called a sub-agent), including its name, description, underlying task, or run config." |
| 863 | + ), |
856 | 864 | ) |
857 | 865 | async def edit_kiln_task_tool( |
858 | 866 | project_id: Annotated[ |
|
0 commit comments