Official Schema: See the JSON Schema definition for the authoritative tool configuration specification.
Tool Structure
Every tool definition follows this structure:Required Fields
All SQL tools must include these fields:Field Details
- tool_name
- source
- description
- statement
Unique identifier for the toolThe tool name is the YAML key and must be unique across all tools.Naming conventions:
- Use lowercase with underscores:
get_active_jobs - Be descriptive:
find_employees_by_departmentnotemp_search - Prefix by domain if needed:
perf_system_status,sec_audit_trail
Parameters
Parameters define dynamic inputs for SQL tools. Each parameter specifies type, validation rules, and usage information.Complete Parameter Guide
See the full Parameter Guide for detailed examples of all parameter types, validation patterns, and best practices for building SQL tools with parameters.
Parameter Structure
Parameter Types
- String
- Integer
- Float
- Boolean
- Array
Text values with validationValidation options:
pattern- Regular expression for validationminLength- Minimum string lengthmaxLength- Maximum string lengthenum- Fixed list of allowed valuesdefault- Default value if not provided
Optional Parameters
Parameters withoutrequired: true or with default values are optional:
Security Configuration
Add security controls to tools for enhanced protection:Security Fields
- readOnly
- maxQueryLength
- forbiddenKeywords
Mark tools as read-only (SELECT queries only):Default:
Best Practice: Mark all tools that don’t modify data as
readOnly: true. This provides clear documentation and can be used for access control.true (for safety - tools are read-only by default)Response Formatting
Control how tool results are formatted for AI agents:responseFormat
Type:string
Options: json (default), markdown
- json - Structured data (default, best for AI processing)
- markdown - Formatted text with markdown syntax
Fetch-Row Controls
Control how many rows are fetched from the database per tool call. These are distinct frommaxDisplayRows, which only truncates the rendered markdown table.
Database vs. display limits:
rowsToFetch / fetchAllRows change how many rows the server pulls from Db2 for i. maxDisplayRows only affects how many rows appear in the formatted output. A tool can fetch 500 rows from the database but render only the first 100 in markdown.Fields
The two fields compose:fetchAllRows is the pagination policy; rowsToFetch, when set, is the per-fetch size in pagination mode, or a single-shot row cap when fetchAllRows is off.
Composition
When the paginated result hits
IBMI_PAGINATION_MAX_ROWS, the server truncates the rows returned and emits a warning log. The CLI surfaces the truncation in the output footer so callers know the result was clipped.
- rowsToFetch (single-shot)
- fetchAllRows (paginate)
- Paginate with custom page size
- Default (neither)
Lift the 100-row cap for a single callUse when:
- Your
FETCH FIRST :limit ROWS ONLYclause needs more than 100 rows - You know the expected result size and want a predictable ceiling
- You want row-count safety without running paginated fetches
Setting
rowsToFetch alone does not automatically raise your SQL’s FETCH FIRST clause — you still need a parameter or literal that matches. rowsToFetch is the ceiling at the driver level.Metadata
Add descriptive metadata for tool organization and discovery:Metadata Fields
title
title
Human-readable title for the tool
version
version
Semantic version for tracking tool changes
keywords
keywords
Search keywords for tool discovery
lastUpdated
lastUpdated
Date of last modification (ISO format)
domain
domain
Business domain classification (monitoring, security, business, etc.)
category
category
Functional category within domain
environment
environment
Target environment (production, development, testing)
Complete Tool Examples
Simple Query (No Parameters)
String Parameter with Validation
Multiple Parameters with Different Types
Tool with Security Configuration
Array Parameter Tool
Best Practices
SQL Statement Design
SQL Statement Design
Optimization:
- Always include
FETCH FIRST n ROWS ONLYto limit results - Use
LEFT JOINinstead ofINNER JOINwhen relationships are optional - Add
ORDER BYfor consistent result ordering - Use column aliases for better AI understanding
Parameter Validation
Parameter Validation
Always validate:
- String patterns for IBM i names:
^[A-Z][A-Z0-9_]*$ - String lengths:
maxLength: 10for library names - Integer ranges:
minimum: 1, maximum: 1000 - Required vs optional: Mark appropriately
Description Quality
Description Quality
Write for AI agents:
- Be specific about what data is returned
- Mention any special authority requirements
- Include parameter examples in descriptions
- Note any result limits or performance considerations
Security Considerations
Security Considerations
Mark sensitive tools:
- Set
audit: truefor all tools accessing user data - Use
readOnly: truefor SELECT-only operations - Document required authorities in
security.requiredAuthority - Add warnings for potentially destructive operations
Next Steps
Sources Reference
Configure database connection sources
Toolsets Reference
Organize tools into logical groups
Building SQL Tools
Step-by-step guide with examples
Parameter Validation
Deep dive into validation rules
Tool Design Philosophy: Effective tools are discoverable (clear names and descriptions), safe (proper validation and security), and performant (optimized SQL with result limits). Write tools for AI agent consumption, not just human readability.