Skip to main content
Glama
Strom-Capital

mcp-server-db2i

Index Advice

index_advice
Read-onlyIdempotent

List indexes the query optimizer requested for a library's tables, showing key columns, advice counts, and reasons, to help you decide which indexes to create.

Instructions

List the indexes the query optimizer asked for on the tables of a library, from the IBM i index advisor (QSYS2.SYSIXADV). Rows with the same table, key columns, and index type are merged into one, with counts summed and reason codes described. Sorted by mti_used, then times_advised: advice where the optimizer kept building and reusing a maintained temporary index (MTI) is the strongest signal. key_columns are in CREATE INDEX order and can end in DESC. last_advised and since are in the system's local time. This tool only reads the advice; it does not create indexes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum rows to return. Capped by QUERY_MAX_LIMIT.
sinceNoOnly advice last given on or after this date or timestamp, in the IBM i system's local time with no time zone. Example: "2026-01-31" or "2026-01-31 08:00:00"
tableNoTable name. Omit for every table in the library.
schemaNoSchema (library) whose tables to read advice for. Uses the system's default schema if not provided.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo
causeNoWhy the statement failed. &1-style placeholders stand for values in error.
countNo
errorNo
sinceNo
tableNo
schemaNo
sqlcodeNoSQLCODE of the failed statement, such as -204
successYes
recoveryNoWhat to change before trying again
sqlstateNoSQLSTATE of the failed statement
truncatedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.0.0

TDQS

A4.1/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/idempotent/non-destructive, and the description goes well beyond them: it discloses row-merging behavior with summed counts, sort order (mti_used then times_advised), CREATE INDEX column ordering with possible DESC suffix, local-time semantics for last_advised/since, and the explicit constraint that no indexes are created. This is exactly the behavioral context an agent needs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose, then ordered into aggregation, sorting, column format, time semantics, and the read-only guarantee. Dense but every sentence adds distinct information; only the time-zone sentence is arguably redundant with the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, return values need not be explained, yet the description still usefully characterizes the shape of results (merged rows, reason codes, sort order) and the read-only scope. Scope, filters, and interpretation are covered; only explicit sibling routing is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all four parameters are already documented in the schema, including the local-time format for 'since' and the limit cap. The description's remark that last_advised and since are in system local time largely restates the schema, adding no syntax or format detail beyond it, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('List the indexes the query optimizer asked for... from the IBM i index advisor (QSYS2.SYSIXADV)') and distinguishes itself from siblings like list_indexes by making clear this is advisor output, not actual index definitions. An agent can tell exactly what it returns without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied rather than stated: the tool is for inspecting optimizer advice before creating indexes, and the description helps interpret results ('advice where the optimizer kept building and reusing an MTI is the strongest signal'). However, it never names an alternative sibling (e.g. list_indexes) or an explicit when-not condition, so routing guidance is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.