Skip to content

feat(mcp): add list-indexes discovery tool (RAAE-1605)#630

Draft
vishal-bala wants to merge 1 commit into
feature/raae-1604-config-runtime-modelfrom
feature/raae-1605-list-indexes
Draft

feat(mcp): add list-indexes discovery tool (RAAE-1605)#630
vishal-bala wants to merge 1 commit into
feature/raae-1604-config-runtime-modelfrom
feature/raae-1605-list-indexes

Conversation

@vishal-bala

@vishal-bala vishal-bala commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #629 (RAAE-1604). Review/merge that first; this PR targets the 1604 branch so the diff is scoped to the discovery tool.

Motivation

Once a single MCP server can expose multiple logical indexes (RAAE-1604), clients need a lightweight way to discover what's available so they can pick the right index instead of guessing. This PR (RAAE-1605) adds an always-registered, read-only list-indexes tool for exactly that, and it grounds discovery in the schema the server already inspected at startup rather than asking users to re-declare field metadata in config.

Implementation

The new tool (redisvl/mcp/tools/list_indexes.py) returns one entry per configured binding, in configured order: the logical id, an optional description, an upsert_available flag, the shared filterable fields, and — only when explicitly configured — a limits object. upsert_available is simply not effective_read_only, so it already reflects both the global --read-only flag and the per-index read_only policy resolved at startup. The fields list is built from the binding's effective (inspected + overridden) schema that already lives on its BindingRuntime, so the output stays consistent with what the index actually contains; the vector field and the configured default embed-source text field are omitted because they are implementation inputs rather than fields a client would filter on. The Redis index name (redis_name) is deliberately never exposed. Limits are included only when the operator set them explicitly — detected via the runtime model's model_fields_set — so defaults don't masquerade as deliberate overrides; per the contract this covers max_limit and max_upsert_records.

The tool is registered unconditionally during the server's tool registration (alongside search-records and the conditionally-registered upsert-records) and is gated by the same read scope as search when auth is enabled, since it is read-only.

  • Output is deterministic and ordered by configured binding.
  • No new configuration surface or settings are required.

Verification

  • mypy clean; black/isort formatted.
  • New unit coverage: field omission (vector + embed-source), description/limits inclusion rules, redis_name secrecy, read-only reflection, single- and multi-binding output, and tool registration.
  • New integration test starts a real two-binding server (one vector, one fulltext) and asserts the discovered fields come from the inspected schema and follow the omission rules.
  • Full MCP suite green: 178 unit + 45 integration (2 skipped on Redis-version gates) against Redis 8.

🤖 Generated with Claude Code

Add an always-registered, read-only `list-indexes` MCP tool so clients can
enumerate the logical indexes a multi-index server exposes and choose the
right one before calling search-records or upsert-records.

For each configured binding the tool returns the logical id, an optional
description, whether upsert is available (reflecting both the global
--read-only flag and the per-index read_only policy), the shared filterable
fields, and any explicitly configured runtime limits. Fields are derived from
the binding's already-inspected effective schema rather than user-declared
metadata; the vector field and the configured default embed-source text field
are omitted because they are implementation inputs, not things a client
filters on. The Redis index name (redis_name) is never exposed. Limits are
surfaced only when explicitly set in config (detected via the runtime model's
model_fields_set), so the output reflects deliberate overrides rather than
defaults.

- New redisvl/mcp/tools/list_indexes.py with list_indexes() + register_list_indexes_tool().
- Registered unconditionally in the server's tool registration, alongside search/upsert.
- Output is deterministic and ordered by configured binding.
- TDD: unit coverage for field omission, description/limits inclusion rules,
  redis_name secrecy, read-only reflection, and registration; integration test
  verifying fields are derived from the inspected schema across a vector and a
  fulltext binding.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jit-ci

jit-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant