You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/mcp/msi/filesystem.go
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,10 @@ var ReadFile = &mcp.Tool{
42
42
Description: `Reads and returns the content of a specified file.`,
43
43
}
44
44
45
+
typeReadFileResultstruct {
46
+
Contentstring`json:"content" jsonschema:"The content of the file."`
47
+
}
48
+
45
49
typeReadFileParamsstruct {
46
50
Pathstring`json:"path" jsonschema:"The absolute path to the file to read."`
47
51
// TODO: Offset *int `json:"offset,omitempty" jsonschema:"For text files, the 0-based line number to start reading from. Requires limit to be set."`
@@ -53,6 +57,10 @@ var WriteFile = &mcp.Tool{
53
57
Description: `Writes content to a specified file. If the file exists, it will be overwritten. If the file doesn't exist, it (and any necessary parent directories) will be created.`,
54
58
}
55
59
60
+
typeWriteFileResultstruct {
61
+
// Empty for now
62
+
}
63
+
56
64
typeWriteFileParamsstruct {
57
65
Pathstring`json:"path" jsonschema:"The absolute path to the file to write to."`
58
66
Contentstring`json:"content" jsonschema:"The content to write into the file."`
@@ -69,6 +77,10 @@ type GlobParams struct {
69
77
// TODO: CaseSensitive bool `json:"case_sensitive,omitempty" jsonschema:": Whether the search should be case-sensitive. Defaults to false."`
70
78
}
71
79
80
+
typeGlobResultstruct {
81
+
Matches []string`json:"matches" jsonschema:"A list of absolute file paths that match the provided glob pattern."`
82
+
}
83
+
72
84
varSearchFileContent=&mcp.Tool{
73
85
Name: "search_file_content",
74
86
Description: `Searches for a regular expression pattern within the content of files in a specified directory. Internally calls 'git grep -n --no-index'.`,
@@ -80,4 +92,8 @@ type SearchFileContentParams struct {
80
92
Include*string`json:"include,omitempty" jsonschema:"A glob pattern to filter which files are searched (e.g., '*.js', 'src/**/*.{ts,tsx}'). If omitted, searches most files (respecting common ignores)."`
81
93
}
82
94
95
+
typeSearchFileContentResultstruct {
96
+
GitGrepOutputstring`json:"git_grep_output" jsonschema:"The raw output from the 'git grep -n --no-index' command, containing matching lines with filenames and line numbers."`
Directory: pathStr, // Directory must be always set
164
163
})
164
+
iferr!=nil {
165
+
returncmdToolRes, nil, err
166
+
}
167
+
res:=&msi.SearchFileContentResult{
168
+
GitGrepOutput: cmdRes.Stdout,
169
+
}
170
+
return&mcp.CallToolResult{
171
+
// Gemini:
172
+
// A message like: Found 10 matching lines for regex "function\\s+myFunction" in directory src:\nsrc/file1.js:10:function myFunction() {...}\nsrc/subdir/file2.ts:45: function myFunction(param) {...}...
0 commit comments