Skip to content

Commit b340dc4

Browse files
authored
chore: update style guide for tool spec navigation (#2203)
1 parent ce64c3a commit b340dc4

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

docs/STYLE_GUIDE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,16 @@ class EdgeCondition(Protocol):
7474
```
7575

7676
Using `Protocol` with `**kwargs` allows the interface to evolve by adding new keyword arguments without breaking existing implementations that don't use them.
77+
78+
### Tool Name References
79+
80+
When comparing against tool names in hooks or plugins, use the tool instance's `tool_name` property instead of hardcoding strings. Tool specs can be modified at runtime via the `AgentTool.tool_spec` setter, so hardcoded names may not match the actual registered name.
81+
82+
```python
83+
# Good
84+
if event.tool_use.get("name") == self.my_tool.tool_name:
85+
...
86+
87+
# Bad — fragile if tool name is changed at runtime
88+
if event.tool_use.get("name") == "my_tool":
89+
...

0 commit comments

Comments
 (0)