MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / cursorToolCallResultSummary

Function cursorToolCallResultSummary

internal/loop/cursor_parser.go:333–400  ·  view source on GitHub ↗
(tc *cursorToolCall)

Source from the content-addressed store, hash-verified

331}
332
333func cursorToolCallResultSummary(tc *cursorToolCall) string {
334 if tc.ReadToolCall != nil && tc.ReadToolCall.Result != nil && tc.ReadToolCall.Result.Success != nil {
335 return tc.ReadToolCall.Result.Success.Content
336 }
337 if tc.WriteToolCall != nil && tc.WriteToolCall.Result != nil && tc.WriteToolCall.Result.Success != nil {
338 s := tc.WriteToolCall.Result.Success
339 if s.Path != "" {
340 return s.Path
341 }
342 return "(written)"
343 }
344 if tc.EditToolCall != nil && tc.EditToolCall.Result != nil && tc.EditToolCall.Result.Success != nil {
345 return "(edited)"
346 }
347 if tc.ShellToolCall != nil && tc.ShellToolCall.Result != nil && tc.ShellToolCall.Result.Success != nil {
348 s := tc.ShellToolCall.Result.Success
349 if s.Output != "" {
350 return strings.TrimSpace(s.Output)
351 }
352 if s.ExitCode != nil {
353 return fmt.Sprintf("(exit %d)", *s.ExitCode)
354 }
355 return "(executed)"
356 }
357 if tc.GrepToolCall != nil && tc.GrepToolCall.Result != nil && tc.GrepToolCall.Result.Success != nil {
358 for _, v := range tc.GrepToolCall.Result.Success.WorkspaceResults {
359 return fmt.Sprintf("%d matches", v.Content.TotalMatchedLines)
360 }
361 return "(matches)"
362 }
363 if tc.GlobToolCall != nil && tc.GlobToolCall.Result != nil && tc.GlobToolCall.Result.Success != nil {
364 n := tc.GlobToolCall.Result.Success.TotalFiles
365 return fmt.Sprintf("%d files", n)
366 }
367 if tc.LsToolCall != nil && tc.LsToolCall.Result != nil && tc.LsToolCall.Result.Success != nil {
368 return "(listed)"
369 }
370 if tc.DeleteToolCall != nil && tc.DeleteToolCall.Result != nil && tc.DeleteToolCall.Result.Success != nil {
371 return "(deleted)"
372 }
373 if tc.WebFetchToolCall != nil && tc.WebFetchToolCall.Result != nil && tc.WebFetchToolCall.Result.Success != nil {
374 s := tc.WebFetchToolCall.Result.Success
375 if s.Markdown != "" {
376 return strings.TrimSpace(s.Markdown)
377 }
378 return "(fetched)"
379 }
380 if tc.WebSearchToolCall != nil && tc.WebSearchToolCall.Result != nil && tc.WebSearchToolCall.Result.Success != nil {
381 refs := tc.WebSearchToolCall.Result.Success.References
382 if len(refs) == 0 {
383 return "(no results)"
384 }
385 if len(refs) == 1 && refs[0].Chunk != "" {
386 return strings.TrimSpace(refs[0].Chunk)
387 }
388 return fmt.Sprintf("%d reference(s)", len(refs))
389 }
390 if tc.Function != nil && len(tc.Function.Result) > 0 {

Callers 1

parseCursorToolCallFunction · 0.85

Calls 1

Tested by

no test coverage detected