@@ -17,13 +17,15 @@ import (
1717 "github.com/lima-vm/lima/v2/pkg/ptr"
1818)
1919
20+ const MetaWarnings = "io.lima-vm/warnings"
21+
2022func (ts * ToolSet ) ListDirectory (ctx context.Context ,
2123 _ * mcp.CallToolRequest , args msi.ListDirectoryParams ,
2224) (* mcp.CallToolResult , * msi.ListDirectoryResult , error ) {
2325 if ts .inst == nil {
2426 return nil , nil , errors .New ("instance not registered" )
2527 }
26- guestPath , logs , err := ts .TranslateHostPath (args .Path )
28+ guestPath , warnings , err := ts .TranslateHostPath (args .Path )
2729 if err != nil {
2830 return nil , nil , err
2931 }
@@ -44,10 +46,8 @@ func (ts *ToolSet) ListDirectory(ctx context.Context,
4446 callToolRes := & mcp.CallToolResult {
4547 StructuredContent : res ,
4648 }
47- if logs != "" {
48- callToolRes .Meta = map [string ]any {
49- "io.lima-vm/logs" : []string {logs },
50- }
49+ if warnings != "" {
50+ callToolRes .Meta [MetaWarnings ] = warnings
5151 }
5252 return callToolRes , res , nil
5353}
@@ -58,7 +58,7 @@ func (ts *ToolSet) ReadFile(_ context.Context,
5858 if ts .inst == nil {
5959 return nil , nil , errors .New ("instance not registered" )
6060 }
61- guestPath , logs , err := ts .TranslateHostPath (args .Path )
61+ guestPath , warnings , err := ts .TranslateHostPath (args .Path )
6262 if err != nil {
6363 return nil , nil , err
6464 }
@@ -82,10 +82,8 @@ func (ts *ToolSet) ReadFile(_ context.Context,
8282 // (e.g., [File content truncated: showing lines 1-100 of 500 total lines...]\nActual file content...).
8383 StructuredContent : res ,
8484 }
85- if logs != "" {
86- callToolRes .Meta = map [string ]any {
87- "io.lima-vm/logs" : []string {logs },
88- }
85+ if warnings != "" {
86+ callToolRes .Meta [MetaWarnings ] = warnings
8987 }
9088 return callToolRes , res , nil
9189}
@@ -96,7 +94,7 @@ func (ts *ToolSet) WriteFile(_ context.Context,
9694 if ts .inst == nil {
9795 return nil , nil , errors .New ("instance not registered" )
9896 }
99- guestPath , logs , err := ts .TranslateHostPath (args .Path )
97+ guestPath , warnings , err := ts .TranslateHostPath (args .Path )
10098 if err != nil {
10199 return nil , nil , err
102100 }
@@ -121,10 +119,8 @@ func (ts *ToolSet) WriteFile(_ context.Context,
121119 // or `Successfully created and wrote to new file: /path/to/new/file.txt.`
122120 StructuredContent : res ,
123121 }
124- if logs != "" {
125- callToolRes .Meta = map [string ]any {
126- "io.lima-vm/logs" : []string {logs },
127- }
122+ if warnings != "" {
123+ callToolRes .Meta [MetaWarnings ] = warnings
128124 }
129125 return callToolRes , res , nil
130126}
@@ -142,7 +138,7 @@ func (ts *ToolSet) Glob(_ context.Context,
142138 if args .Path != nil && * args .Path != "" {
143139 pathStr = * args .Path
144140 }
145- guestPath , logs , err := ts .TranslateHostPath (pathStr )
141+ guestPath , warnings , err := ts .TranslateHostPath (pathStr )
146142 if err != nil {
147143 return nil , nil , err
148144 }
@@ -162,10 +158,8 @@ func (ts *ToolSet) Glob(_ context.Context,
162158 // A message like: Found 5 file(s) matching "*.ts" within src, sorted by modification time (newest first):\nsrc/file1.ts\nsrc/subdir/file2.ts...
163159 StructuredContent : res ,
164160 }
165- if logs != "" {
166- callToolRes .Meta = map [string ]any {
167- "io.lima-vm/logs" : []string {logs },
168- }
161+ if warnings != "" {
162+ callToolRes .Meta [MetaWarnings ] = warnings
169163 }
170164 return callToolRes , res , nil
171165}
@@ -183,7 +177,7 @@ func (ts *ToolSet) SearchFileContent(ctx context.Context,
183177 if args .Path != nil && * args .Path != "" {
184178 pathStr = * args .Path
185179 }
186- guestPath , logs , err := ts .TranslateHostPath (pathStr )
180+ guestPath , warnings , err := ts .TranslateHostPath (pathStr )
187181 if err != nil {
188182 return nil , nil , err
189183 }
@@ -205,10 +199,8 @@ func (ts *ToolSet) SearchFileContent(ctx context.Context,
205199 // 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) {...}...
206200 StructuredContent : res ,
207201 }
208- if logs != "" {
209- callToolRes .Meta = map [string ]any {
210- "io.lima-vm/logs" : []string {logs },
211- }
202+ if warnings != "" {
203+ callToolRes .Meta [MetaWarnings ] = warnings
212204 }
213205 return callToolRes , res , nil
214206}
0 commit comments