@@ -43,20 +43,6 @@ async def wrap_call_tool(wrapped, instance, args, kwargs):
43
43
return await wrapped (* args , ** kwargs )
44
44
45
45
46
- async def wrap_call_tool1 (wrapped , instance , args , kwargs ):
47
- transaction = current_transaction ()
48
- if not transaction :
49
- return await wrapped (* args , ** kwargs )
50
-
51
- func_name = callable_name (wrapped )
52
- bound_args = bind_args (wrapped , args , kwargs )
53
- tool_name = bound_args .get ("name" ) or "tool"
54
- function_trace_name = f"{ func_name } /{ tool_name } "
55
-
56
- with FunctionTrace (name = function_trace_name , group = "Llm/tool/MCPPPPP" , source = wrapped ):
57
- return await wrapped (* args , ** kwargs )
58
-
59
-
60
46
async def wrap_read_resource (wrapped , instance , args , kwargs ):
61
47
transaction = current_transaction ()
62
48
if not transaction :
@@ -101,27 +87,6 @@ async def wrap_get_prompt(wrapped, instance, args, kwargs):
101
87
return await wrapped (* args , ** kwargs )
102
88
103
89
104
- async def wrap_call_fn_with_arg_validation (wrapped , instance , args , kwargs ):
105
- with FunctionTrace (name = "call_fn_with_arg_validation" , group = "Llm/argssss/MCP" , source = wrapped ):
106
- return await wrapped (* args , ** kwargs )
107
-
108
-
109
- async def wrap_run (wrapped , instance , args , kwargs ):
110
- with FunctionTrace (name = "call_fn_with_arg_validation" , group = "Llm/MCP/base/tool/run" , source = wrapped ):
111
- return await wrapped (* args , ** kwargs )
112
-
113
-
114
- async def wrap_tool_manager (wrapped , instance , args , kwargs ):
115
- with FunctionTrace (name = "call_tool" , group = "Llm/MCP/tool_manager" , source = wrapped ):
116
- return await wrapped (* args , ** kwargs )
117
-
118
-
119
- async def wrap__handle_request (wrapped , instance , args , kwargs ):
120
- func_name = callable_name (wrapped )
121
- with FunctionTrace (name = "func_name" , group = "Llm/MCP/handle_request" , source = wrapped ):
122
- return await wrapped (* args , ** kwargs )
123
-
124
-
125
90
def instrument_mcp_client_session (module ):
126
91
if hasattr (module , "ClientSession" ):
127
92
if hasattr (module .ClientSession , "call_tool" ):
@@ -132,31 +97,7 @@ def instrument_mcp_client_session(module):
132
97
wrap_function_wrapper (module , "ClientSession.get_prompt" , wrap_get_prompt )
133
98
134
99
135
- def instrument_mcp_server_fastmcp_server (module ):
136
- if hasattr (module , "FastMCP" ):
137
- if hasattr (module .FastMCP , "call_tool" ):
138
- wrap_function_wrapper (module , "FastMCP.call_tool" , wrap_call_tool1 )
139
-
140
-
141
- def instrument_mcp_server_lowlevel_server (module ):
142
- wrap_function_wrapper (module , "Server._handle_request" , wrap__handle_request )
143
-
144
-
145
- def instrument_mcp_server_fastmcp_utilities_func_metadata (module ):
146
- pass
147
- # if hasattr(module, "FuncMetadata"):
148
- # if hasattr(module.FuncMetadata, "call_fn_with_arg_validation"):
149
- # wrap_function_wrapper(module, "FuncMetadata.call_fn_with_arg_validation", wrap_call_fn_with_arg_validation)
150
-
151
-
152
- def instrument_mcp_server_fastmcp_tools_base (module ):
153
- pass
154
- # if hasattr(module, "Tool"):
155
- # if hasattr(module.Tool, "run"):
156
- # wrap_function_wrapper(module, "Tool.run", wrap_run)
157
-
158
-
159
100
def instrument_mcp_server_fastmcp_tools_tool_manager (module ):
160
101
if hasattr (module , "ToolManager" ):
161
102
if hasattr (module .ToolManager , "call_tool" ):
162
- wrap_function_wrapper (module , "ToolManager.call_tool" , wrap_call_tool )
103
+ wrap_function_wrapper (module , "ToolManager.call_tool" , wrap_call_tool )
0 commit comments