--tools flag.
Built-in vs YAML tools: Built-in tools are TypeScript implementations compiled into the server binary. YAML tools are user-defined SQL queries loaded at runtime via
--tools. Both types coexist and appear identically to AI agents.Quick Start
Enable built-in tools with the--builtin-tools and --execute-sql flags:
--builtin-toolsenables the 5 schema discovery tools (list_schemas,list_tables_in_schema,get_table_columns,get_related_objects,validate_query)--execute-sqlenablesexecute_sqlfor running queriesdescribe_sql_objectis always available regardless of flags
Recommended Workflow
The built-in tools are designed to be chained in a progressive discovery pattern:1
Discover schemas
Use
list_schemas to find available libraries/schemas on the system.2
Browse tables
Use
list_tables_in_schema to list tables, views, and physical files within a schema.3
Inspect columns
Use
get_table_columns to understand a table’s structure before writing queries.4
Check dependencies
Optionally use
get_related_objects for impact analysis or describe_sql_object to view DDL.5
Validate SQL
Use
validate_query to check syntax and verify that referenced objects exist.6
Execute query
Use
execute_sql to run the validated query and retrieve results.Tool Reference
list_schemas
List available schemas/libraries on the IBM i system. Use this as the first step in schema discovery to find which schemas contain relevant tables. Catalog view:QSYS2.SYSSCHEMAS
Parameters
Response columns
list_tables_in_schema
List tables, views, and physical files in a specific schema with metadata including row counts. Use afterlist_schemas to find tables before querying column details.
Catalog views: QSYS2.SYSTABLES joined with QSYS2.SYSTABLESTAT
Parameters
Response columns
get_table_columns
Get column metadata for a table including names, data types, lengths, nullability, defaults, and descriptions. Use this to understand table structure before writing SQL queries. Catalog view:QSYS2.SYSCOLUMNS2
Parameters
Response columns
Null or undefined values are automatically stripped from each row to reduce response size. Only columns with values are included in the output.
get_related_objects
Get all objects that depend on a database file — views, indexes, triggers, foreign keys, logical files, and more. Use for impact analysis before schema changes or to understand a table’s dependency graph. Catalog function:SYSTOOLS.RELATED_OBJECTS
Parameters
Valid
object_type_filter values:
ALIAS, FOREIGN KEY, FUNCTION, HISTORY TABLE, INDEX, KEYED LOGICAL FILE, LOGICAL FILE, MASK, MATERIALIZED QUERY TABLE, PERMISSION, PROCEDURE, TEXT INDEX, TRIGGER, VARIABLE, VIEW, XML SCHEMA
Response columns
validate_query
Validate SQL query syntax and verify that referenced tables, columns, functions, and procedures exist in the system catalog. This tool performs multi-step validation:- Syntax check — Uses
QSYS2.PARSE_STATEMENTto parse the SQL statement - Table verification — Cross-references parsed table names against
QSYS2.SYSTABLES - Column verification — Checks columns against
QSYS2.SYSCOLUMNS - Routine verification — Verifies functions/procedures against
QSYS2.SYSROUTINES
Parameters
Response structure
execute_sql
Execute a SQL query on the IBM i database and return the results. Use this after validating your query withvalidate_query.
Parameters
Response structure
Security
execute_sql applies two layers of validation before running any query:
- AST/regex validation via
SqlSecurityValidator— checks read-only mode constraints and query length - Native IBM i validation via
QSYS2.PARSE_STATEMENT— confirmsSQL_STATEMENT_TYPE = 'QUERY'when in read-only mode
By default, only SELECT queries are allowed (
IBMI_EXECUTE_SQL_READONLY=true). Set IBMI_EXECUTE_SQL_READONLY=false to allow INSERT, UPDATE, DELETE, and other statement types.describe_sql_object
Generate the SQL DDL statement for an IBM i database object. Use this to see the full CREATE definition of a table, view, index, procedure, function, or other object. Catalog procedure:QSYS2.GENERATE_SQL
Parameters
Valid
object_type values:
ALIAS, CONSTRAINT, FUNCTION, INDEX, MASK, PERMISSION, PROCEDURE, SCHEMA, SEQUENCE, TABLE, TRIGGER, TYPE, VARIABLE, VIEW, XSR
Response structure
Pagination
Tools that support pagination (list_schemas, list_tables_in_schema) use a consistent pattern:
The response includes a
hasMore boolean indicating whether additional pages exist. To paginate:
Configuration
Built-in tools are controlled via CLI flags or environment variables. CLI flags take precedence over environment variables.CLI Flags
Combine both flags for the complete text-to-SQL workflow. Each flag can also be used independently.
Environment Variables
Examples
Tool Annotations
All built-in tools include MCP tool annotations that help AI agents understand tool behavior:
*
execute_sql annotations change based on IBMI_EXECUTE_SQL_READONLY: when true (default), readOnlyHint=true and destructiveHint=false; when false, readOnlyHint=false and destructiveHint=true.
Next Steps
YAML Tools Overview
Build custom SQL tools with zero TypeScript using YAML configuration
Using Default YAML Tools
Load pre-built YAML tool collections for system admin, security, and performance
Quickstart
Get the server running with your first AI agent
Server Configuration
Complete environment variable and server configuration reference