11. MCP tools reference
Arguments, results, error codes and examples for every tool, including the agent and interactive tools: see the detailed MCP reference.
The MCP server lets an AI agent (Claude Desktop, Claude Code, Cowork or any MCP client) work on your databases through SmartFBX. Turn it on with the MCP switch; it starts the API too.
11.1 Connecting a client
| Item | Value |
|---|---|
| Endpoint | http://<MCP listen address>:<MCP port>/mcp (default 127.0.0.1, port 8092), JSON-RPC over HTTP |
| Address | Set in Settings > MCP listen address: 127.0.0.1 (default) = only programs on this computer; 0.0.0.0 or a network address = AI agents on other computers too, protected by the API access token |
| Connections | The agent sees the connections of SmartFBX by name (sfb_db_connections) and passes connection_name to the other tools; passwords never leave SmartFBX |
| Safety | Write tools have dry_run = true by default; scripts follow the upload → review → execute workflow; PSQL changes go through validate → apply with a backup of the previous source |
Example configuration for a client that supports remote HTTP servers:
{ "mcpServers": { "smartfbx": { "type": "http", "url": "http://127.0.0.1:8092/mcp" } } }
Arguments are in snake_case; req marks required arguments. connection_name is optional for most tools (empty = the connection selected in SmartFBX) and required, with no fallback, for the agent tools of chapter 12.
11.2 Database
| Tool | Arguments | Description |
|---|---|---|
sfb_db_connections |
— | Names of the configured connections |
sfb_db_info |
connection_name |
Version, path, driver, character set, page size, dialect |
sfb_schema_summary |
connection_name |
Counts of tables, views, procedures, functions, triggers, generators, domains, foreign keys. Call it first to get oriented |
11.3 Metadata
| Tool | Arguments | Description |
|---|---|---|
sfb_meta_tables |
filter, system_tables |
Tables with description |
sfb_meta_table |
table_namereq, with_fields, with_indexes, with_fk, with_triggers |
Full structure of a table |
sfb_meta_views |
— | Views |
sfb_meta_procedures |
filter, with_params |
Stored procedures |
sfb_meta_functions |
filter, exclude_udf |
PSQL functions and legacy UDFs |
sfb_meta_generators |
filter, with_value |
Generators with optional current value |
sfb_meta_domains |
filter, user_defined_only (default true) |
Domains: type, size, default, check, character set. Use before proposing DDL, to reuse domains |
sfb_meta_check_constraints |
table_name (empty = all) |
CHECK constraints: business rules encoded in the database |
sfb_meta_fk_graph |
table_name, direction (from, to, empty) |
Foreign-key graph |
sfb_meta_dependencies |
object_namereq, direction (uses, used_by, both) |
Dependencies of an object |
sfb_meta_ddl |
object_namereq, object_type (table, procedure, function, view, trigger) |
DDL of an object |
sfb_describe |
table_namereq, descriptionreq, object_type (table, field), field_name |
Writes RDB$DESCRIPTION of a table or field, to annotate the database |
req = required argument
11.4 SQL and DDL
| Tool | Arguments | Description |
|---|---|---|
sfb_sql_query |
connection_namereq, sqlreq, params, limit (1-1000, default 200), offset |
Parameterised SELECT/CTE in a read-only transaction, typed columns, paging (has_more, next_offset) |
sfb_sql_execute |
sqlreq, max_rows (default 200), read_only (default true) |
SELECT, or DML with read_only = false |
sfb_sql_explain |
sqlreq |
Execution plan |
sfb_ddl_diff |
table_namereq, proposed_ddlreq |
Compares a table with a proposed CREATE TABLE and returns the needed ALTER TABLE statements. Use before sfb_ddl_execute |
sfb_ddl_execute |
sqlreq (one statement), dry_run (default true) |
Runs a DDL statement; with dry_run it is rolled back |
11.5 Scripts
| Tool | Arguments | Description |
|---|---|---|
sfb_script_upload |
sqlreq, titlereq, connection_name, author |
Stores a script for human review (status pending) |
sfb_script_list |
status (pending, executed, failed, empty) |
Uploaded scripts |
sfb_script_get |
script_idreq |
SQL and metadata |
sfb_script_execute |
script_idreq, connection_name |
Runs an approved script. Only after the user has reviewed it |
sfb_script_delete |
script_idreq |
Deletes a script |
The scripts can be reviewed in the /scripts web page (section 10.9).
11.6 Xtumble named queries
For databases with the Xtumble schema only.
| Tool | Arguments | Description |
|---|---|---|
sfb_nq_groups |
— | Groups/entities with the number of named queries |
sfb_nq_list |
entity_groups, filter, with_sql |
Named queries by group |
sfb_nq_detail |
namereq, entity_groups |
SQL, count SQL, typed output fields, parameters |
sfb_nq_execute |
namereq, params (JSON text), entity_groups, max_rows |
Runs a named query |
sfb_nq_validate |
sql_textreq, name, params, query_count, group |
Dry run: name, lengths, parameters, SELECT FIRST 0 check by Firebird; writes nothing |
sfb_nq_register |
namereq, sql_textreq, description, params, query_count, group (default global), read_only (default true), generator_name |
Registers a new named query (one INSERT) after all validations |
sfb_nq_update |
namereq, sql_text, description, query_count, params, group |
Updates an existing named query and returns the previous definition |
The agent tools (sfb_source_*, sfb_change_*, sfb_row_*, sfb_procedure_execute) and the interactive ui_* tools are described in chapter 12.