Skip to content

Commit 94d91f1

Browse files
committed
Fix index_repo conditional and remove stale enum from MCP tools
Agent-Id: agent-9c6981c4-45dd-4c45-bec4-386d78c4bd30
1 parent 35f06b1 commit 94d91f1

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/clients/mcp-server.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export async function createMCPServer(
103103
searchOnly: config.searchOnly,
104104
});
105105

106-
const { indexNames, indexes } = runner;
107106
const searchOnly = !runner.hasFileOperations();
108107

109108
// Create MCP server
@@ -151,6 +150,32 @@ export async function createMCPServer(
151150
},
152151
},
153152
{
153+
name: "search",
154+
description: searchDescription,
155+
inputSchema: {
156+
type: "object",
157+
properties: {
158+
index_name: {
159+
type: "string",
160+
description: "Name of the index to search.",
161+
},
162+
query: {
163+
type: "string",
164+
description: "Natural language description of what you're looking for.",
165+
},
166+
maxChars: {
167+
type: "number",
168+
description: "Maximum characters in response (optional).",
169+
},
170+
},
171+
required: ["index_name", "query"],
172+
},
173+
},
174+
];
175+
176+
// Add index_repo if store supports write operations
177+
if ('save' in config.store) {
178+
tools.push({
154179
name: "index_repo",
155180
description: "Create or update an index from a repository. This may take 30+ seconds for large repos. The index will be available for search, list_files, and read_file after creation.",
156181
inputSchema: {
@@ -192,31 +217,8 @@ export async function createMCPServer(
192217
},
193218
required: ["name", "source_type"],
194219
},
195-
},
196-
{
197-
name: "search",
198-
description: searchDescription,
199-
inputSchema: {
200-
type: "object",
201-
properties: {
202-
index_name: {
203-
type: "string",
204-
description: "Name of the index to search.",
205-
enum: indexNames,
206-
},
207-
query: {
208-
type: "string",
209-
description: "Natural language description of what you're looking for.",
210-
},
211-
maxChars: {
212-
type: "number",
213-
description: "Maximum characters in response (optional).",
214-
},
215-
},
216-
required: ["index_name", "query"],
217-
},
218-
},
219-
];
220+
});
221+
}
220222

221223
// Add delete_index if store supports it
222224
if ('delete' in config.store) {
@@ -248,7 +250,6 @@ export async function createMCPServer(
248250
index_name: {
249251
type: "string",
250252
description: "Name of the index.",
251-
enum: indexNames,
252253
},
253254
directory: {
254255
type: "string",
@@ -279,7 +280,6 @@ export async function createMCPServer(
279280
index_name: {
280281
type: "string",
281282
description: "Name of the index.",
282-
enum: indexNames,
283283
},
284284
path: {
285285
type: "string",

0 commit comments

Comments
 (0)