MCPcopy Index your code
hub / github.com/github/copilot-sdk / Confirm

Method Confirm

go/session.go:1192–1217  ·  view source on GitHub ↗

Confirm shows a confirmation dialog and returns the user's boolean answer. Returns false if the user declines or cancels.

(ctx context.Context, message string)

Source from the content-addressed store, hash-verified

1190// Confirm shows a confirmation dialog and returns the user's boolean answer.
1191// Returns false if the user declines or cancels.
1192func (ui *SessionUI) Confirm(ctx context.Context, message string) (bool, error) {
1193 if err := ui.session.assertElicitation(); err != nil {
1194 return false, err
1195 }
1196 rpcResult, err := ui.session.RPC.UI.Elicitation(ctx, &rpc.UIElicitationRequest{
1197 Message: message,
1198 RequestedSchema: rpc.UIElicitationSchema{
1199 Type: rpc.UIElicitationSchemaTypeObject,
1200 Properties: map[string]rpc.UIElicitationSchemaProperty{
1201 "confirmed": &rpc.UIElicitationSchemaPropertyBoolean{
1202 Default: Bool(true),
1203 },
1204 },
1205 Required: []string{"confirmed"},
1206 },
1207 })
1208 if err != nil {
1209 return false, err
1210 }
1211 if rpcResult.Action == rpc.UIElicitationResponseActionAccept {
1212 if value, ok := rpcResult.Content["confirmed"].(rpc.UIElicitationBooleanValue); ok {
1213 return bool(value), nil
1214 }
1215 }
1216 return false, nil
1217}
1218
1219// Select shows a selection dialog with the given options.
1220// Returns the selected string, or empty string and false if the user declines/cancels.

Callers 2

TestUIElicitationE2EFunction · 0.80

Calls 3

BoolFunction · 0.85
assertElicitationMethod · 0.45
ElicitationMethod · 0.45

Tested by 2

TestUIElicitationE2EFunction · 0.64