Spaces:
Paused
Paused
File size: 945 Bytes
9792ea7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # -*- coding: utf-8 -*-
"""The task tool base class, providing unified interface and permission
check for builtin task related tools."""
from typing import Any
from .._base import ToolBase
from ...permission import (
PermissionContext,
PermissionDecision,
PermissionBehavior,
)
class _TaskToolBase(ToolBase):
name: str
description: str
input_schema: dict
is_concurrency_safe: bool = True
is_read_only: bool = False
is_state_injected: bool = True
is_external_tool: bool = False
is_mcp: bool = False
mcp_name: str | None = None
async def check_permissions(
self,
tool_input: dict[str, Any],
context: PermissionContext,
) -> PermissionDecision:
"""Check permission for the tool usage."""
return PermissionDecision(
behavior=PermissionBehavior.ALLOW,
message=f"{self.name} is always allowed to be called.",
)
|