Skip to content

Commit 262c6c1

Browse files
committed
fix: enhance wrapped_call_tool to include approved parameter
1 parent d45dcea commit 262c6c1

File tree

1 file changed

+16
-4
lines changed
  • sentry_sdk/integrations/pydantic_ai/patches

1 file changed

+16
-4
lines changed

sentry_sdk/integrations/pydantic_ai/patches/tools.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ def _patch_tool_execution():
4040
original_call_tool = ToolManager._call_tool
4141

4242
@wraps(original_call_tool)
43-
async def wrapped_call_tool(self, call, *args, **kwargs):
44-
# type: (Any, Any, *Any, **Any) -> Any
43+
async def wrapped_call_tool(
44+
self, call, *, allow_partial, wrap_validation_errors, approved
45+
):
46+
# type: (Any, Any, bool, bool, bool) -> Any
4547

4648
# Extract tool info before calling original
4749
name = call.tool_name
@@ -72,7 +74,11 @@ async def wrapped_call_tool(self, call, *args, **kwargs):
7274
) as span:
7375
try:
7476
result = await original_call_tool(
75-
self, call, wrap_validation_errors
77+
self,
78+
call,
79+
allow_partial=allow_partial,
80+
wrap_validation_errors=wrap_validation_errors,
81+
approved=approved,
7682
)
7783
update_execute_tool_span(span, result)
7884
return result
@@ -81,6 +87,12 @@ async def wrapped_call_tool(self, call, *args, **kwargs):
8187
raise exc from None
8288

8389
# No span context - just call original
84-
return await original_call_tool(self, call, *args, **kwargs)
90+
return await original_call_tool(
91+
self,
92+
call,
93+
allow_partial=allow_partial,
94+
wrap_validation_errors=wrap_validation_errors,
95+
approved=approved,
96+
)
8597

8698
ToolManager._call_tool = wrapped_call_tool

0 commit comments

Comments
 (0)