MCPcopy Index your code
hub / github.com/coder/coder / responseErrorResult

Function responseErrorResult

coderd/x/chatd/chattool/chattool.go:43–59  ·  view source on GitHub ↗

responseErrorResult converts a codersdk.Response into a structured tool result. We return these via toolResponse rather than NewTextErrorResponse because the fantasy/chatprompt pipeline flattens IsError content into a single string and drops validation details.

(resp codersdk.Response)

Source from the content-addressed store, hash-verified

41// NewTextErrorResponse because the fantasy/chatprompt pipeline flattens
42// IsError content into a single string and drops validation details.
43func responseErrorResult(resp codersdk.Response) map[string]any {
44 message := resp.Message
45 if message == "" {
46 message = "request failed"
47 }
48
49 result := map[string]any{
50 "error": message,
51 }
52 if resp.Detail != "" {
53 result["detail"] = resp.Detail
54 }
55 if len(resp.Validations) > 0 {
56 result["validations"] = resp.Validations
57 }
58 return result
59}
60
61func latestWorkspaceBuildAndJob(
62 ctx context.Context,

Callers 3

CreateWorkspaceFunction · 0.85
StartWorkspaceFunction · 0.85
StopWorkspaceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected