You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Step 2a: Auto-generate system tools from catalog tables
138
138
139
-
You can generate a suite of reusable data tools (Schema, Profile, Read, Search Summary, Search Content, Analyze) directly from catalog tables and their descriptions. This is helpful for quickly exposing exploratory and read/query capabilities to MCP.
139
+
You can generate a suite of reusable data tools (Schema, Profile, Read, Search Summary, Search Content, Analyze) directly from catalog tables and their descriptions.
140
+
This is helpful for quickly exposing exploratory and read/query capabilities to MCP. Available tools include:
141
+
142
+
- Schema: list columns/types for any or all tables
143
+
- Profile: column statistics (counts, basic numeric analysis [min, max, mean, etc.], contextual information for text columns [average_length, etc.])
144
+
- Read: read a selection of rows from a single table. These rows can be paged over, filtered and can use column projections.
145
+
- Search Summary: regex search across all text columns in all tables -- returns back dataframe names with result counts.
146
+
- Search Content: regex search across a single table, specifying one or more text columns to search across -- returns back rows corresponding to the query.
147
+
- Analyze: Write raw SQL to perform complex analysis on one or more tables.
140
148
141
149
Requirements:
142
150
@@ -147,37 +155,34 @@ Example:
147
155
```python
148
156
from fenic import Session
149
157
from fenic.api.mcp.server import create_mcp_server
150
-
from fenic.api.mcp.tools importToolGenerationConfig
158
+
from fenic.api.mcp.tools importSystemToolConfig
151
159
152
160
session = Session.get_or_create(...)
153
161
server = create_mcp_server(
154
162
session,
155
163
server_name="Fenic MCP",
156
-
system_tools=ToolGenerationConfig(
157
-
table_names=["orders", "users"],
158
-
tool_group_name="Dataset Exploration",
164
+
system_tools=SystemToolConfig(
165
+
table_names=session.catalog.list_tables(),
166
+
tool_namespace="Dataset Exploration",
159
167
max_result_rows=200,
160
168
),
161
169
)
162
170
```
163
171
164
172
## Step 3a: Serve tools programmatically
165
173
166
-
Use the MCP server helpers to serve existing catalog tools. If you want all registered tools, call `list_tools()`. If you want a subset, fetch by name.
174
+
Use the MCP server helpers to serve existing catalog tools. To use all catalog tools in the MCP server,
175
+
pass `session.catalog.list_tools` to `create_mcp_server`:
167
176
168
177
```python
169
178
from fenic import Session,SessionConfig
170
-
from fenic.api.mcp.server import create_mcp_server, run_mcp_server_sync, run_mcp_server_async, run_mcp_server_asgi,
179
+
from fenic.api.mcp.server import create_mcp_server, run_mcp_server_sync, run_mcp_server_async, run_mcp_server_asgi
171
180
172
181
session = Session.get_or_create(SessionConfig(
173
182
app_name="mcp_example",
174
183
...
175
184
))
176
-
177
-
# Load all catalog tools
178
-
tools = session.catalog.list_tools()
179
-
180
-
server = create_mcp_server(session, server_name="Fenic MCP", user_defined_tools=tools)
185
+
server = create_mcp_server(session, server_name="Fenic MCP", user_defined_tools=session.catalog.list_tools())
181
186
182
187
# Run HTTP server (defaults shown); if additional configuration is required, any argument that can be passed to FastMCP `run` can be passed here
"Show the schema (column names and types) for any or all of the datasets listed below. This call should be the first step in exploring the available datasets.",
"Read rows from a single dataset. Use to sample data, or to execute simple queries over the data that do not require filtering or grouping.",
97
95
"Use `include_columns` and `exclude_columns` to filter columns by name -- this is important to conserve token usage. Use the `Profile` tool to understand the columns and their sizes.",
0 commit comments