1111
1212from __future__ import annotations
1313
14- import asyncio
15- import functools
1614import hashlib
17- import inspect
1815import re
1916from dataclasses import dataclass
20- from inspect import iscoroutinefunction
2117from typing import (
22- Any ,
23- Callable ,
24- Coroutine ,
2518 Dict ,
2619 List ,
2720 Literal ,
4538from fenic .core ._logical_plan .plans .base import LogicalPlan
4639from fenic .core ._utils .schema import convert_custom_dtype_to_polars
4740from fenic .core .error import ConfigurationError , ValidationError
48- from fenic .core .mcp .types import SystemToolDefinition , TableFormat
41+ from fenic .core .mcp .types import SystemTool
4942from fenic .core .types .datatypes import (
5043 BooleanType ,
5144 DoubleType ,
@@ -92,7 +85,7 @@ def auto_generate_system_tools_from_tables(
9285 * ,
9386 tool_group_name : str ,
9487 max_result_limit : int = 100 ,
95- ) -> List [SystemToolDefinition ]:
88+ ) -> List [SystemTool ]:
9689 """Generate Schema/Profile/Read/Search/Analyze tools from catalog tables.
9790
9891 Validates that each table exists and has a non-empty description in catalog metadata.
@@ -112,7 +105,7 @@ def _auto_generate_read_tool(
112105 tool_description : str ,
113106 * ,
114107 result_limit : int = 50 ,
115- ) -> SystemToolDefinition :
108+ ) -> SystemTool :
116109 """Create a read tool over one or many datasets."""
117110 if len (datasets ) == 0 :
118111 raise ConfigurationError ("Cannot create read tool: no datasets provided." )
@@ -165,7 +158,7 @@ async def read_func(
165158 sort_ascending = sort_ascending ,
166159 )
167160
168- return SystemToolDefinition (
161+ return SystemTool (
169162 name = tool_name ,
170163 description = tool_description ,
171164 func = read_func ,
@@ -179,7 +172,7 @@ def _auto_generate_search_summary_tool(
179172 session : Session ,
180173 tool_name : str ,
181174 tool_description : str ,
182- ) -> SystemToolDefinition :
175+ ) -> SystemTool :
183176 """Create a grep-like summary tool over one or many datasets (string columns)."""
184177 if len (datasets ) == 0 :
185178 raise ValueError ("Cannot create search summary tool: no datasets provided." )
@@ -205,7 +198,7 @@ async def search_summary(
205198 pl_df = pl .DataFrame (rows )
206199 return InMemorySource .from_session_state (pl_df , session ._session_state )
207200
208- return SystemToolDefinition (
201+ return SystemTool (
209202 name = tool_name ,
210203 description = tool_description ,
211204 func = search_summary ,
@@ -220,7 +213,7 @@ def _auto_generate_search_content_tool(
220213 tool_description : str ,
221214 * ,
222215 result_limit : int = 100 ,
223- ) -> SystemToolDefinition :
216+ ) -> SystemTool :
224217 """Create a content search tool for a single dataset (string columns)."""
225218 if len (datasets ) == 0 :
226219 raise ValidationError ("Cannot create search content tool: no datasets provided." )
@@ -276,7 +269,7 @@ async def search_rows(
276269 sort_ascending = sort_ascending ,
277270 )
278271
279- return SystemToolDefinition (
272+ return SystemTool (
280273 name = tool_name ,
281274 description = tool_description ,
282275 func = search_rows ,
@@ -290,7 +283,7 @@ def _auto_generate_schema_tool(
290283 session : Session ,
291284 tool_name : str ,
292285 tool_description : str ,
293- ) -> SystemToolDefinition :
286+ ) -> SystemTool :
294287 """Create a schema tool over one or many datasets.
295288
296289 - Returns one row per dataset with a column `schema` containing a list of
@@ -337,7 +330,7 @@ async def schema_func(
337330 session ._session_state ,
338331 )
339332
340- return SystemToolDefinition (
333+ return SystemTool (
341334 name = tool_name ,
342335 description = tool_description .strip (),
343336 func = schema_func ,
@@ -352,7 +345,7 @@ def _auto_generate_sql_tool(
352345 tool_description : str ,
353346 * ,
354347 result_limit : int = 100 ,
355- ) -> SystemToolDefinition :
348+ ) -> SystemTool :
356349 """Create an Analyze tool that executes DuckDB SELECT SQL across datasets.
357350
358351 - JOINs between the provided datasets are allowed.
@@ -389,7 +382,7 @@ async def analyze_func(
389382 )
390383 enhanced_description = "\n " .join (lines )
391384
392- tool = SystemToolDefinition (
385+ tool = SystemTool (
393386 name = tool_name ,
394387 description = enhanced_description ,
395388 func = analyze_func ,
@@ -485,7 +478,7 @@ def _auto_generate_profile_tool(
485478 tool_description : str ,
486479 * ,
487480 topk_distinct : int = 10 ,
488- ) -> SystemToolDefinition :
481+ ) -> SystemTool :
489482 """Create a cached Profile tool for one or many datasets.
490483
491484 Output columns include:
@@ -525,7 +518,7 @@ async def profile_func(
525518
526519 return profile_df ._logical_plan
527520
528- return SystemToolDefinition (
521+ return SystemTool (
529522 name = tool_name ,
530523 description = tool_description ,
531524 func = profile_func ,
@@ -700,7 +693,7 @@ def _auto_generate_system_tools(
700693 * ,
701694 tool_group_name : str ,
702695 max_result_limit : int = 100 ,
703- ) -> List [SystemToolDefinition ]:
696+ ) -> List [SystemTool ]:
704697 """Generate core tools spanning all datasets: Schema, Profile, Analyze.
705698
706699 - Schema: list columns/types for any or all datasets
0 commit comments