Skip to main content
Official Schema: See the JSON Schema definition for parameter specifications.
This guide provides practical examples for using parameters in SQL tools. Parameters make tools dynamic and reusable by accepting inputs that are validated and safely bound to SQL statements.

Quick Reference

All parameter types and their constraints: Common parameter properties:

String Parameters

String parameters accept text values with optional length, pattern, and enum constraints.

Basic String

Use case: Simple text input without validation
SQL usage:
Tool call:

String with Length Constraints

Use case: Enforce minimum/maximum length (e.g., IBM i object names)
Validation:
  • "CUSTFILE" - Valid (8 characters)
  • "" - Error: Too short (0 < 1)
  • "VERYLONGOBJECTNAME" - Error: Too long (18 > 10)

String with Pattern (Regex)

Use case: Enforce specific format (e.g., IBM i naming conventions)
Common patterns:
Validation:
  • "MYLIB" - Valid
  • "APP_LIB" - Valid
  • "mylib" - Error: Doesn’t match pattern (lowercase)
  • "123LIB" - Error: Doesn’t match pattern (starts with number)

String with Enum

Use case: Restrict to specific allowed values
Validation:
  • "*FILE" - Valid
  • "*PGM" - Valid
  • "*TABLE" - Error: Not in enum list
SQL usage:
AI Agent Benefit: Enum parameters are automatically described to AI agents as “Must be one of: ‘*FILE’, ‘*PGM’, ‘*SRVPGM’, ‘*DTAARA’” which helps them select valid values.

Optional String

Use case: Allow filtering that can be skipped
SQL usage with NULL handling:
Tool calls:

Integer Parameters

Integer parameters accept whole numbers with optional min/max constraints.

Basic Integer

Use case: Row limits, counts, IDs
SQL usage:
Validation:
  • 10 - Valid
  • 100 - Valid (at maximum)
  • 0 - Error: Below minimum
  • 150 - Error: Above maximum
  • "10" - Error: Must be integer, not string

Pagination Parameters

Use case: Page number and size for result pagination
SQL usage:
Tool call:

Integer with Enum

Use case: Specific numeric choices

Float Parameters

Float parameters accept decimal numbers for percentages, thresholds, and measurements.

Basic Float

Use case: Percentage multiplier, threshold value
SQL usage:
Tool call:
Validation:
  • 0.1 - Valid
  • 0.25 - Valid
  • 0.5 - Error: Exceeds maximum (0.5 > 0.3)
  • -0.1 - Error: Below minimum

Threshold Example

SQL usage:

Boolean Parameters

Boolean parameters accept true/false values for flags and options.

Basic Boolean

Use case: Include/exclude certain data
SQL usage:
Boolean to SQL: Booleans are passed as 1 (true) or 0 (false) in SQL. Use = 1 or = 0 in WHERE clauses.
Tool calls:

Boolean Flag Examples

SQL with boolean:

Array Parameters

Array parameters accept lists of values, commonly used with SQL IN clauses.

Basic Array

Use case: Filter by multiple values
SQL usage:
Tool call:
Array Format: Arrays must be JSON arrays (["A", "B"]), NOT strings ("('A', 'B')") or SQL syntax.
Validation:
  • ["MA2100"] - Valid (1 item, within minLength)
  • ["MA2100", "AD3100", "PL2100"] - Valid (3 items)
  • [] - Error: Below minLength (0 < 1)
  • ["A", "B", ... "K"] (11 items) - Error: Exceeds maxLength

Array with Different Item Types

Integer array:
Tool call:
Boolean array:
Tool call:

Validation and Error Handling

Validation Process

Parameters are validated in this order:
  1. Type Check - Ensure value matches declared type
  2. Required Check - Ensure required parameters are provided
  3. Constraint Check - Validate min/max, length, pattern, enum
  4. SQL Binding - Safely bind validated parameters to SQL

Common Validation Errors

Error: Expected integer, got string for parameter 'limit'Cause: Passing wrong type
Error: Required parameter 'employee_id' is missingCause: Not providing a required parameter
Error: String length 18 exceeds maximum 10 for parameter 'library_name'Cause: Value violates constraint
Error: Value does not match pattern '^[A-Z][A-Z0-9_]*$' for parameter 'library_name'Cause: Value doesn’t match regex pattern
Error: Value must be one of: *FILE, *PGM, *SRVPGM for parameter 'object_type'Cause: Value not in enum list

Best Practices

1. Write AI-Friendly Descriptions

The description field is shown to AI agents. Make it helpful:

2. Use Appropriate Constraints

Match constraints to your data requirements:

3. Provide Sensible Defaults

For optional parameters, include defaults:

4. Use Enums for Fixed Choices

When values are limited, use enums:

5. Handle Optional Parameters in SQL

Use NULL checks for optional parameters:

Security: Parameter Binding

Critical: Parameters are automatically bound using prepared statements. This prevents SQL injection attacks. NEVER concatenate parameters into SQL strings.
✅ Safe (parameter binding):
❌ Dangerous (string concatenation):
How parameter binding works:
  1. SQL statement is prepared with placeholders: SELECT * FROM employees WHERE employee_id = ?
  2. Parameters are validated against constraints
  3. Parameters are bound separately from the SQL structure
  4. Database executes the prepared statement with bound parameters
This ensures the SQL structure cannot be modified by user input, preventing injection attacks entirely.

Complete Examples

Example 1: Employee Search Tool

Example 2: Project Team Finder

Example 3: System Monitoring Tool


Next Steps

Tools Reference

Complete tool configuration reference

Building SQL Tools

Step-by-step guide to creating tools

Sources Reference

Database connection configuration

Toolsets Reference

Organizing tools into groups
Parameter Design Philosophy: Good parameters make tools flexible without sacrificing safety. Use constraints to enforce data quality, provide defaults for convenience, and write clear descriptions to guide AI agents in using your tools correctly.