Skip to main content
Official Schema: See the JSON Schema definition for the authoritative tool configuration specification.
Tools are individual SQL operations that AI agents can discover and execute. Each tool encapsulates a SQL statement, parameter definitions, validation rules, and execution metadata.

Tool Structure

Every tool definition follows this structure:

Required Fields

All SQL tools must include these fields:

Field Details

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_department not emp_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

Text values with validation
Validation options:
  • pattern - Regular expression for validation
  • minLength - Minimum string length
  • maxLength - Maximum string length
  • enum - Fixed list of allowed values
  • default - Default value if not provided
Example with enum:

Optional Parameters

Parameters without required: true or with default values are optional:
SQL handling for optional parameters:

Security Configuration

Add security controls to tools for enhanced protection:

Security Fields

Mark tools as read-only (SELECT queries only):
Best Practice: Mark all tools that don’t modify data as readOnly: true. This provides clear documentation and can be used for access control.
Default: 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
Response types:
  • 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 from maxDisplayRows, 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.
Context-bloat warning: Large result sets consume LLM context quickly. Prefer rowsToFetch with a deliberate small value; only use fetchAllRows for small catalogs or when the caller has explicitly requested a full dump.
Lift the 100-row cap for a single call
Use when:
  • Your FETCH FIRST :limit ROWS ONLY clause 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

Human-readable title for the tool
Semantic version for tracking tool changes
Individual or team responsible for the tool
Search keywords for tool discovery
Date of last modification (ISO format)
Business domain classification (monitoring, security, business, etc.)
Functional category within domain
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

Optimization:
  • Always include FETCH FIRST n ROWS ONLY to limit results
  • Use LEFT JOIN instead of INNER JOIN when relationships are optional
  • Add ORDER BY for consistent result ordering
  • Use column aliases for better AI understanding
Example:
Always validate:
  • String patterns for IBM i names: ^[A-Z][A-Z0-9_]*$
  • String lengths: maxLength: 10 for library names
  • Integer ranges: minimum: 1, maximum: 1000
  • Required vs optional: Mark appropriately
Example:
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
Good example:
Mark sensitive tools:
  • Set audit: true for all tools accessing user data
  • Use readOnly: true for SELECT-only operations
  • Document required authorities in security.requiredAuthority
  • Add warnings for potentially destructive operations
Example:

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.