SQL tools support configurable output formatting to optimize readability and control the display of query results. Configure table styles, row limits, and output formats to match your use case.Documentation Index
Fetch the complete documentation index at: https://ibm-d95bab6e.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The output formatting system provides:- Multiple table styles for different display contexts
- Type-aware column alignment (numeric right-aligned, text left-aligned)
- NULL value handling with configurable replacements
- Row truncation with clear truncation indicators
- Metadata display including execution time, row counts, and NULL statistics
Configuration Options
Output formatting is configured using optional fields in the tool definition:| Field | Type | Default | Description |
|---|---|---|---|
responseFormat | enum | markdown | Response format (markdown or json) - required for formatting |
tableFormat | enum | markdown | Table formatting style (see styles below) |
maxDisplayRows | integer | 100 | Maximum rows to display before truncation |
The
tableFormat and maxDisplayRows fields are optional. If omitted, the tool uses default values.Table Format Styles
Four table styles are available to suit different display contexts:1. markdown (Default)
GitHub-flavored markdown table format with column type indicators. Best for documentation, web viewers, and LLM consumption.
Characteristics:
- Uses
|for column separators - Includes
---header separator with alignment indicators - Column headers include type information:
EMPLOYEE_ID (INTEGER) - Numeric columns automatically right-aligned
- Most readable in markdown renderers
- Default choice for most tools
- Documentation and reports
- Web-based interfaces
- LLM-friendly output
2. ascii
Plain ASCII table format using +, -, and | characters. Compatible with any text display.
Characteristics:
- Uses
+for corners and intersections - Uses
-for horizontal borders - Uses
|for vertical borders - Works in any text editor or terminal
- Fixed-width display for consistent alignment
- Plain text environments
- Email or text file output
- Legacy system integration
- Terminal-based tools
3. grid
Unicode box-drawing characters for a polished, professional appearance.
Characteristics:
- Uses Unicode box-drawing characters (
│,┌,┐,├,┤,┴,┬,└,┘) - Visually distinct and modern
- Requires Unicode support
- Slightly more compact than ASCII
- Modern terminal output
- Professional reports
- Rich text environments
- Visual clarity over compatibility
4. compact
Minimal spacing for space-constrained displays.
Characteristics:
- Reduced column padding (1 space instead of 2)
- Still uses markdown-style separators
- Maintains alignment and readability
- Most space-efficient option
- Mobile or narrow displays
- High-density information display
- Logs with space constraints
- Minimalist output preferences
Maximum Display Rows
ThemaxDisplayRows field controls how many rows are displayed before truncation occurs.
Display vs. fetch:
maxDisplayRows only truncates the rendered table — the server still fetched those rows from the database. To change how many rows are pulled from Db2 for i, see fetch-row controls in the Tools Reference.Configuration
Constraints:- Minimum:
1 - Maximum:
1000 - Default:
100
- If result row count ≤
maxDisplayRows: All rows are displayed - If result row count >
maxDisplayRows: FirstmaxDisplayRowsrows shown with truncation alert
Truncation Alert
When truncation occurs, a clear alert message is displayed:Use Cases for Different Limits
| Limit | Use Case |
|---|---|
1-10 | Quick previews, debugging |
10-50 | Interactive queries, dashboards |
50-100 | Standard reports (default) |
100-500 | Detailed analysis |
500-1000 | Comprehensive exports |
Configuration Examples
Example 1: Default Configuration
Most tools work well with defaults (markdown format, 100-row limit):Example 2: ASCII Format
Example 3: Grid Format
Example 4: Compact Format
Example 5: High Row Limit
Automatic Features
Column Type Awareness
Columns are automatically aligned based on database types:- Right-aligned: INTEGER, DECIMAL, FLOAT, NUMERIC (all numeric types)
- Left-aligned: VARCHAR, CHAR, DATE, TIME, TIMESTAMP (text and temporal types)
SALARY (DECIMAL)
Example Output:
NULL Value Handling
- NULL values display as
-(dash) - NULL counts tracked per column in metadata
- Consistent across all table formats
Complete Output Structure
A fully-formatted SQL tool response includes:- Tool Name Header (H2)
- Success Alert with checkmark
- Result Table with type-aware formatting
- Truncation Alert (if applicable)
- Metadata Section with:
- Execution time
- Row counts (displayed and total)
- NULL value statistics
- Parameter values used
- Performance Metrics (optional)
Example Complete Output
Best Practices
Format Selection
Choose the right format for your context:- markdown
- ascii
- grid
- compact
Use for:
- LLM consumption (default)
- Web-based UIs
- Documentation
- Markdown renderers
- Most readable
- Type annotations
- Alignment indicators
Row Limits by Use Case
| Use Case | Recommended Limit | Rationale |
|---|---|---|
| Interactive tools | 10-50 rows | Quick response, focused results |
| Standard reports | 50-100 rows | Balanced (default) |
| Analysis tools | 100-500 rows | Comprehensive view |
| Export tools | 500-1000 rows | Maximum data |
| Debug/preview | 1-10 rows | Minimal output |
Performance Considerations
Lower Row Limits
- Faster response times
- Reduced network transfer
- Better for interactive use
- Combine with SQL LIMIT
SQL Optimization
- Use SQL
LIMITclauses at database level - Add
ORDER BYfor most relevant rows first - Consider pagination for large datasets
- Index columns used in ORDER BY
Combining with SQL
Best practice: Use both SQL-level and display-level limits:- Database does less work (FETCH FIRST)
- Network transfers less data
- Display limit acts as safety net
- Consistent results across reruns
Comparison: All Table Styles
- markdown
- ascii
- grid
- compact
Next Steps
Parameters
Learn about parameter types and constraints
Validation
Understand parameter validation
Building Tools
Step-by-step tool creation guide
SQL Tools Overview
Introduction to the SQL tools system