Skip to content

Commit 93a3f89

Browse files
update mcp
1 parent 55a3e9e commit 93a3f89

2 files changed

Lines changed: 13 additions & 16 deletions

File tree

packages/mcp/src/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,12 @@ server.tool(
7070
query += ` ( lang:${languages.join(' or lang:')} )`;
7171
}
7272

73-
if (caseSensitive) {
74-
query += ` case:yes`;
75-
} else {
76-
query += ` case:no`;
77-
}
78-
7973
const response = await search({
8074
query,
8175
matches: env.DEFAULT_MATCHES,
8276
contextLines: env.DEFAULT_CONTEXT_LINES,
77+
isRegexEnabled: true,
78+
isCaseSensitivityEnabled: caseSensitive,
8379
});
8480

8581
if (isServiceError(response)) {

packages/mcp/src/schemas.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ export const symbolSchema = z.object({
2121
kind: z.string(),
2222
});
2323

24+
export const searchOptionsSchema = z.object({
25+
matches: z.number(), // The number of matches to return.
26+
contextLines: z.number().optional(), // The number of context lines to return.
27+
whole: z.boolean().optional(), // Whether to return the whole file as part of the response.
28+
isRegexEnabled: z.boolean().optional(), // Whether to enable regular expression search.
29+
isCaseSensitivityEnabled: z.boolean().optional(), // Whether to enable case sensitivity.
30+
});
31+
2432
export const searchRequestSchema = z.object({
25-
// The zoekt query to execute.
26-
query: z.string(),
27-
// The number of matches to return.
28-
matches: z.number(),
29-
// The number of context lines to return.
30-
contextLines: z.number().optional(),
31-
// Whether to return the whole file as part of the response.
32-
whole: z.boolean().optional(),
33+
query: z.string(), // The zoekt query to execute.
34+
...searchOptionsSchema.shape,
3335
});
3436

3537
export const repositoryInfoSchema = z.object({
@@ -109,7 +111,7 @@ export const searchStatsSchema = z.object({
109111
regexpsConsidered: z.number(),
110112

111113
// FlushReason explains why results were flushed.
112-
flushReason: z.number(),
114+
flushReason: z.string(),
113115
});
114116

115117
export const searchResponseSchema = z.object({
@@ -139,7 +141,6 @@ export const searchResponseSchema = z.object({
139141
content: z.string().optional(),
140142
})),
141143
repositoryInfo: z.array(repositoryInfoSchema),
142-
isBranchFilteringEnabled: z.boolean(),
143144
isSearchExhaustive: z.boolean(),
144145
});
145146

0 commit comments

Comments
 (0)