Repository navigation
feat(tool/elasticsearch-list-indices): add tool to list indices - #4569
yaroslav-koval wants to merge 4 commits into
Conversation
Add the elasticsearch-list-indices tool so an agent can discover index names. It takes optional comma-separated names or wildcard patterns and an output_format (simple or detailed). Indices starting with a dot are listed only when a pattern starts with a dot. The tool is added to the elasticsearch prebuilt config, with unit tests, an integration test and docs.
There was a problem hiding this comment.
Code Review
This pull request introduces a new elasticsearch-list-indices tool to list the indices of an Elasticsearch cluster, supporting both simple and detailed output formats. It includes the tool implementation, configuration updates, documentation, and corresponding unit and integration tests. The review feedback highlights potential connection leaks in the integration tests due to unclosed response bodies from several Elasticsearch API requests (IndicesDeleteRequest, IndicesCreateRequest, and IndexRequest), which should be resolved by ensuring res.Body.Close() is called.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new elasticsearch-list-indices tool to list indices of an Elasticsearch cluster, including source implementation, unit and integration tests, prebuilt configurations, and documentation. Feedback on the changes suggests defining detailedColumns directly as a slice literal instead of using append at runtime to improve readability and avoid unnecessary allocation overhead.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new elasticsearch-list-indices tool to list the indices of an Elasticsearch cluster, along with its implementation, tests, and documentation. The reviewer suggested a performance optimization to precompute and reuse the column name slices as package-level variables to avoid redundant allocations on every tool invocation.
…ices The names are derived once at package init from simpleColumns and detailedColumns, so they cannot drift. googleapis#4569 (comment)
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new elasticsearch-list-indices tool (named list_indices) to list the indices of an Elasticsearch cluster. The implementation includes adding the ListIndices method to the Elasticsearch source, registering the new tool, updating prebuilt configurations, and adding comprehensive documentation and tests. Feedback on the changes suggests defining the detailedColumns slice directly as a literal rather than appending to simpleColumns at runtime to improve code readability and maintainability.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new tool 'elasticsearch-list-indices' (name 'list_indices') to list the indices of an Elasticsearch cluster. It implements the 'ListIndices' method on the Elasticsearch source, adds the tool implementation, updates documentation, registers the tool in the prebuilt configurations, and adds comprehensive unit and integration tests. There are no review comments, and I have no feedback to provide.
|
Hey @duwenxin99, I resolved all the Gemini reviews, this PR is ready. Could you review it, please? |
Description
Adds the
elasticsearch-list-indicestool: it lists the indices of a cluster.Impact. Today an agent cannot find out which indices exist. The only Elasticsearch
tools run ES|QL, and ES|QL has no command to list indices, so the agent can only query
an index whose name it already knows. I use the ES MCP daily and this is one of the most
useful tools. I'll create a PR for index mappings later, so the agent can start with zero
knowledge about the cluster.
How it works. It takes
patterns(likeusers,logs-*) and returns all the indices that match. With the default value*it lists all the indices.output_format(simpleordetailed) sets how many fields outputted. Indicesstarting with
.are listed only when a pattern starts with.. Read-only.Changes.
elasticsearch-list-indicesand source methodListIndicesare added.list_indicesis added to theelasticsearchprebuilt config.Security.
patternsgoes into the request path throughesapi.CatIndicesRequest,so the client escapes it. No credentials are logged. Auth checks are not overridden.
PR Checklist
CONTRIBUTING.md
bug/issue
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
review
!if this involve a breaking change