mirror of
https://github.com/lWolvesl/claw-code.git
synced 2026-04-03 01:11:51 +08:00
Rewriting Project Claw Code - Python port with Rust on the way
This commit is contained in:
37
src/tool_pool.py
Normal file
37
src/tool_pool.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from .models import PortingModule
|
||||
from .permissions import ToolPermissionContext
|
||||
from .tools import get_tools
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ToolPool:
|
||||
tools: tuple[PortingModule, ...]
|
||||
simple_mode: bool
|
||||
include_mcp: bool
|
||||
|
||||
def as_markdown(self) -> str:
|
||||
lines = [
|
||||
'# Tool Pool',
|
||||
'',
|
||||
f'Simple mode: {self.simple_mode}',
|
||||
f'Include MCP: {self.include_mcp}',
|
||||
f'Tool count: {len(self.tools)}',
|
||||
]
|
||||
lines.extend(f'- {tool.name} — {tool.source_hint}' for tool in self.tools[:15])
|
||||
return '\n'.join(lines)
|
||||
|
||||
|
||||
def assemble_tool_pool(
|
||||
simple_mode: bool = False,
|
||||
include_mcp: bool = True,
|
||||
permission_context: ToolPermissionContext | None = None,
|
||||
) -> ToolPool:
|
||||
return ToolPool(
|
||||
tools=get_tools(simple_mode=simple_mode, include_mcp=include_mcp, permission_context=permission_context),
|
||||
simple_mode=simple_mode,
|
||||
include_mcp=include_mcp,
|
||||
)
|
||||
Reference in New Issue
Block a user