File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 27
27
from .message import Message
28
28
from .models import get_model
29
29
from .prompts import get_prompt
30
- from .tools import execute_msg , get_tool
30
+ from .tools import execute_msg , has_tool
31
31
from .tools .browser import read_url
32
32
from .util import epoch_to_age , generate_name
33
33
@@ -578,7 +578,7 @@ def _parse_prompt(prompt: str) -> str | None:
578
578
for path in paths :
579
579
result += _parse_prompt (path ) or ""
580
580
581
- if get_tool ("browser" ) is None :
581
+ if not has_tool ("browser" ):
582
582
logger .warning ("Browser tool not available, skipping URL read" )
583
583
else :
584
584
for url in urls :
Original file line number Diff line number Diff line change 1
1
import logging
2
- from collections .abc import Generator
2
+ from collections .abc import Callable , Generator
3
3
from dataclasses import dataclass
4
- from collections .abc import Callable
5
4
from xml .etree import ElementTree
6
5
7
6
from ..message import Message
@@ -210,3 +209,10 @@ def get_tool(tool_name: str) -> ToolSpec:
210
209
if tool .name == tool_name :
211
210
return tool
212
211
raise ValueError (f"Tool '{ tool_name } ' not found" )
212
+
213
+
214
+ def has_tool (tool_name : str ) -> bool :
215
+ for tool in loaded_tools :
216
+ if tool .name == tool_name :
217
+ return True
218
+ return False
You can’t perform that action at this time.
0 commit comments