MCPcopy Create free account
hub / github.com/continuedev/continue / fileGlobSearchImpl

Function fileGlobSearchImpl

core/tools/implementations/globSearch.ts:7–41  ·  view source on GitHub ↗
(args, extras)

Source from the content-addressed store, hash-verified

5const MAX_AGENT_GLOB_RESULTS = 100;
6
7export const fileGlobSearchImpl: ToolImpl = async (args, extras) => {
8 const pattern = getStringArg(args, "pattern");
9 const results = await extras.ide.getFileResults(
10 pattern,
11 MAX_AGENT_GLOB_RESULTS,
12 );
13
14 if (results.length === 0) {
15 return [
16 {
17 name: "File results",
18 description: "glob search",
19 content: "The glob search returned no results.",
20 },
21 ];
22 }
23 const contextItems: ContextItem[] = [
24 {
25 name: "File results",
26 description: "glob search",
27 content: results.join("\n"),
28 },
29 ];
30
31 // In case of truncation, add a warning
32 if (results.length === MAX_AGENT_GLOB_RESULTS) {
33 contextItems.push({
34 name: "Truncation warning",
35 description: "",
36 content: `Warning: the results above were truncated to the first ${MAX_AGENT_GLOB_RESULTS} files. If the results are not satisfactory, refine your search pattern`,
37 });
38 }
39
40 return contextItems;
41};

Callers 1

callBuiltInToolFunction · 0.90

Calls 3

getStringArgFunction · 0.90
getFileResultsMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected