Skip to main content
Tools are the primary way MCP clients interact with your data. Each tool wraps a SQL query with typed parameters, metadata, and safety annotations.

Tool Builder Layout

The tool builder uses a 3-column layout:
ColumnPurpose
LeftSQL editor (Monaco) for writing the query
CenterParameter designer for defining inputs
RightPreview panel with execution results and code output

Writing SQL Queries

Use :param_name to define query parameters:
SELECT *
FROM users
WHERE status = :status
  AND created_at >= :start_date
LIMIT :limit
Parameters are automatically detected from the query text and appear in the center column for configuration.

Parameter Designer

Each detected parameter can be configured:
FieldDescription
NameAuto-detected from :name in SQL
Typestring, integer, number, or boolean
RequiredWhether the client must provide this parameter
DefaultDefault value if not supplied
Enum ValuesRestrict input to allowed values (comma-separated)
DescriptionHuman-readable description shown to MCP clients

SQL Preview

The right column includes a Preview tab for test-executing your query:
  1. Fill in test values for each parameter
  2. Click Run Preview
  3. Results display in a table format
Preview queries execute in read-only mode with an automatic LIMIT applied.

Tool Metadata

FieldDescription
NameTool identifier (used by MCP clients to call the tool)
DescriptionWhat the tool does (shown to LLMs for tool selection)
TagsCategorical labels for organization
Cache TTLHow long results are cached (in seconds, 0 = no cache)

Annotations

Annotations provide safety hints to MCP clients:
AnnotationDescription
read_onlyTool only reads data
destructiveTool may delete or alter data
open_worldTool interacts with external systems
idempotentRepeated calls produce the same result

Transform Templates (Jinja2)

Optionally add a post-processing template to transform SQL results before they reach MCP clients. The transform editor appears below the SQL editor and is collapsible.

Template Context

VariableTypeDescription
rowslist of dictsRaw SQL query results
varsdictServer-level global variables (set in Settings)
paramsdictTool parameter values passed by the caller

Built-in Filters

FilterExampleDescription
tojson{{ rows | tojson }}Serialize to JSON
groupbyrows | groupby('category')Group rows by field
sum_attrrows | sum_attr('amount')Sum a numeric attribute
map_attrrows | map_attr('name')Extract a single field
uniquerows | uniqueDeduplicate rows
Standard Jinja2 built-ins are also available: sum, len, min, max, round, sorted, enumerate, zip, range.

Example: Sum and Count

[{"total_amount": {{ rows | sum(attribute='amount') }}, "count": {{ rows | length }}}]

Example: Filter and Restructure

[
{% for row in rows if row.status == 'active' %}
  {"name": "{{ row.name }}", "revenue": {{ row.revenue | round(2) }}}{% if not loop.last %},{% endif %}
{% endfor %}
]

Example: Use Global Variables

[
{% for row in rows %}
  {"product": "{{ row.name }}", "price": "{{ row.price }} {{ vars.currency }}"}{% if not loop.last %},{% endif %}
{% endfor %}
]

Preview with Transforms

When a transform template is set, the preview panel shows two tabs:
  • Raw — SQL query results as-is
  • Transformed — results after applying the template
Transform errors appear as warnings without blocking the raw results.
Templates run in a sandboxed environment with a 10 MB output limit. Unsafe operations (file access, imports, class introspection) are blocked.

Code Preview

The Code tab shows the generated Python code that will run inside the deployed FastMCP server. This is read-only and updates automatically.

Connection Binding

Each tool must be bound to a database connection. Select the connection from the dropdown at the top of the tool builder.

Duplicating Tools

Open a tool and click Duplicate to create a copy with the name <original>_copy.

Keyboard Shortcuts

ShortcutAction
Ctrl+SSave the current tool
Ctrl+EnterRun preview execution

See Also

Connections

Create and manage the database connections that tools query against

Resources

Expose data as readable MCP resources with URI templates

Prompts

Design reusable prompt templates for LLM interactions

Flow Editor

Manage tools visually on the drag-and-drop canvas

Deployment

Deploy your tools as a running MCP server

REST API

Tool CRUD endpoints in the REST API