From 34270ee790fe98e63bc162c6c378d57d37422299 Mon Sep 17 00:00:00 2001 From: susan Date: Fri, 11 Apr 2025 11:16:01 -0400 Subject: [PATCH] Add index pattern arg for list indices tool --- index.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index 4c1ad7a..8551906 100644 --- a/index.ts +++ b/index.ts @@ -112,10 +112,19 @@ export async function createElasticsearchMcpServer( server.tool( "list_indices", "List all available Elasticsearch indices", - {}, - async () => { + { + indexPattern: z + .string() + .trim() + .min(1, "Index pattern is required") + .describe("Index pattern of Elasticsearch indices to list"), + }, + async ( {indexPattern} ) => { try { - const response = await esClient.cat.indices({ format: "json" }); + const response = await esClient.cat.indices({ + index: indexPattern, + format: "json" + }); const indicesInfo = response.map((index) => ({ index: index.index,