@@ -83,11 +83,20 @@ def __init__(
8383 annotations = ToolAnnotations (readOnlyHint = True , openWorldHint = False )
8484 for tool in self .paramaterized_tools :
8585 tool_fn = self ._build_parameterized_tool (tool )
86- self .mcp .tool (annotations = annotations )(tool_fn )
86+ self .mcp .tool (
87+ annotations = annotations ,
88+ name = _to_snake_case (tool .name ),
89+ title = tool .name
90+ )(tool_fn )
8791
8892 for tool in self .dynamic_tools :
8993 tool_fn = self ._register_dynamic_callable (tool )
90- self .mcp .tool (name = self ._to_snake_case (tool .name ), description = tool .description , annotations = annotations )(tool_fn )
94+ self .mcp .tool (
95+ annotations = annotations ,
96+ name = _to_snake_case (tool .name ),
97+ title = tool .name ,
98+ description = tool .description
99+ )(tool_fn )
91100
92101 async def run_async (self , transport : MCPTransport = "http" , ** kwargs ):
93102 """Run the MCP server asynchronously.
@@ -132,7 +141,8 @@ async def tool_fn(params: Union[ParamsModel, str]) -> MCPResultSet: # type: ign
132141 bound_plan = bind_parameters (tool ._parameterized_view , payload , tool .params )
133142 async with self ._collect_semaphore :
134143 pl_df , metrics = await asyncio .to_thread (lambda : self .session_state .execution .collect (bound_plan , n = effective_limit ))
135- logger .info (f"Completed query for { tool .name } in { metrics .execution_time_ms :.0f} ms with { metrics .num_output_rows } result rows." )
144+ logger .info (f"Completed query for { tool .name } " )
145+ logger .info (metrics .get_summary ())
136146 logger .debug (f"Query Details: { params .model_dump_json ()} " )
137147
138148 rows_list = pl_df .to_dicts ()
@@ -150,7 +160,6 @@ async def tool_fn(params: Union[ParamsModel, str]) -> MCPResultSet: # type: ign
150160 from fastmcp .exceptions import ToolError
151161 raise ToolError (f"Fenic server failed to execute tool { tool .name } . Underlying error: { e } " ) from e
152162
153- tool_fn .__name__ = _to_snake_case (tool .name )
154163 pydantic_schema_description = convert_pydantic_model_to_key_descriptions (ParamsModel )
155164 tool_fn .__doc__ = "\n \n " .join ([tool .description , pydantic_schema_description ])
156165 return tool_fn
@@ -177,8 +186,9 @@ async def wrapper(*args, **kwargs) -> MCPResultSet:
177186 pl_df , metrics = await asyncio .to_thread (
178187 lambda : self .session_state .execution .collect (bound_plan , n = n_rows )
179188 )
180- logger .info (f"Completed query for { tool .name } in { metrics .execution_time_ms :.0f} ms with { metrics .num_output_rows } result rows." )
181- logger .debug (f"Query Details: { args } { kwargs } " )
189+ logger .info (f"Completed query for { tool .name } " )
190+ logger .info (metrics .get_summary ())
191+ logger .debug (f"Query Details: { args if args else kwargs } " )
182192 rows_list = pl_df .to_dicts ()
183193 schema_fields = [{"name" : name , "type" : str (dtype )} for name , dtype in pl_df .schema .items ()]
184194 table_format = "structured"
0 commit comments