Base class for all miniClaudeCode tools. Mirrors Claude Code's per-tool interface: - name / description / input_schema -> fed to LLM as tool definitions - check_permissions() -> layer-1 permission gate - execute() -> actual work
| 18 | |
| 19 | |
| 20 | class Tool(ABC): |
| 21 | """Base class for all miniClaudeCode tools. |
| 22 | |
| 23 | Mirrors Claude Code's per-tool interface: |
| 24 | - name / description / input_schema -> fed to LLM as tool definitions |
| 25 | - check_permissions() -> layer-1 permission gate |
| 26 | - execute() -> actual work |
| 27 | """ |
| 28 | |
| 29 | @property |
| 30 | @abstractmethod |
| 31 | def name(self) -> str: ... |
| 32 | |
| 33 | @property |
| 34 | @abstractmethod |
| 35 | def description(self) -> str: ... |
| 36 | |
| 37 | @property |
| 38 | @abstractmethod |
| 39 | def input_schema(self) -> dict[str, Any]: ... |
| 40 | |
| 41 | def check_permissions(self, params: dict[str, Any]) -> str | None: |
| 42 | """Return None if allowed, or a denial reason string.""" |
| 43 | return None |
| 44 | |
| 45 | @abstractmethod |
| 46 | def execute(self, params: dict[str, Any]) -> ToolResult: ... |
| 47 | |
| 48 | def to_api_schema(self) -> dict[str, Any]: |
| 49 | return { |
| 50 | "name": self.name, |
| 51 | "description": self.description, |
| 52 | "input_schema": self.input_schema, |
| 53 | } |
| 54 | |
| 55 | |
| 56 | class ToolRegistry: |
nothing calls this directly
no outgoing calls
no test coverage detected