"""Tool registry."""

from __future__ import annotations

from krim.tools.read import ReadTool
from krim.tools.write import WriteTool
from krim.tools.edit import EditTool
from krim.tools.bash import BashTool
from krim.tools.grep import GrepTool
from krim.tools.glob import GlobTool
from krim.tools.submit import SubmitTool
from krim.tools.skill import SkillTool
from krim.tools.base import Tool


def create_tools() -> list[Tool]:
    """Create fresh tool instances."""
    return [ReadTool(), WriteTool(), EditTool(), BashTool(), GrepTool(), GlobTool(), SkillTool(), SubmitTool()]


def get_tool(tools: list[Tool], name: str) -> Tool | None:
    for t in tools:
        if t.name == name:
            return t
    return None


def tool_schemas(tools: list[Tool]) -> list[dict]:
    return [t.schema() for t in tools]
