Skip to navigation

named_tools

View as MarkdownOpen in Claude

Find which tool names a piece of text mentions, by the rule the tool_named_but_not_offered warning uses:

  • A name with an underscore, such as place_order, counts as a whole word anywhere.
  • A one-word name, such as help, counts only in backticks or before (, since it’s also an ordinary word.
from signalwire.core.contexts import named_tools

Parameters

text
str | NoneRequired

The text to search: a step’s text, a prompt, or a tool result. None or an empty string finds nothing.

tools
Iterable[str]Required

The tool names to look for.

Returns

set[str] — The names found.

Example

from signalwire.core.contexts import named_tools
print(named_tools("Call place_order, then `help`.", ["place_order", "help", "lookup"]))
# {'place_order', 'help'}