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

Function extractFunctionResultText

internal/loop/cursor_parser.go:403–421  ·  view source on GitHub ↗

extractFunctionResultText tries to get a short result string from Cursor function result JSON.

(raw json.RawMessage)

Source from the content-addressed store, hash-verified

401
402// extractFunctionResultText tries to get a short result string from Cursor function result JSON.
403func extractFunctionResultText(raw json.RawMessage) string {
404 var m map[string]interface{}
405 if json.Unmarshal(raw, &m) != nil {
406 return ""
407 }
408 for _, key := range []string{"output", "content", "result", "stdout", "text"} {
409 if v, ok := m[key].(string); ok && v != "" {
410 return v
411 }
412 }
413 if success, ok := m["success"].(map[string]interface{}); ok {
414 for _, key := range []string{"output", "content", "result", "stdout"} {
415 if v, ok := success[key].(string); ok && v != "" {
416 return v
417 }
418 }
419 }
420 return ""
421}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected