Skip to content

Commit 59ec5e7

Browse files
fix(api): add status, approval_request_id to MCP tool call
1 parent 38dbadd commit 59ec5e7

File tree

3 files changed

+123
-60
lines changed

3 files changed

+123
-60
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 106
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-49233088b5e73dbb96bf7af27be3d4547632e3db1c2b00f14184900613325bbc.yml
3-
openapi_spec_hash: b34f14b141d5019244112901c5c7c2d8
4-
config_hash: 94e9ba08201c3d1ca46e093e6a0138fa
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-e205b1f2da6a1f2caa229efa9ede63f2d3d2fedeeb2dd6ed3d880bafdcb0ab88.yml
3+
openapi_spec_hash: c8aee2469a749f6a838b40c57e4b7b06
4+
config_hash: 45dcba51451ba532959c020a0ddbf23c

conversations/item.go

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,9 @@ type ConversationItemUnion struct {
176176
Outputs []responses.ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
177177
ServerLabel string `json:"server_label"`
178178
// This field is from variant [ConversationItemMcpListTools].
179-
Tools []ConversationItemMcpListToolsTool `json:"tools"`
180-
Error string `json:"error"`
181-
// This field is from variant [ConversationItemMcpApprovalResponse].
182-
ApprovalRequestID string `json:"approval_request_id"`
179+
Tools []ConversationItemMcpListToolsTool `json:"tools"`
180+
Error string `json:"error"`
181+
ApprovalRequestID string `json:"approval_request_id"`
183182
// This field is from variant [ConversationItemMcpApprovalResponse].
184183
Approve bool `json:"approve"`
185184
// This field is from variant [ConversationItemMcpApprovalResponse].
@@ -777,21 +776,32 @@ type ConversationItemMcpCall struct {
777776
ServerLabel string `json:"server_label,required"`
778777
// The type of the item. Always `mcp_call`.
779778
Type constant.McpCall `json:"type,required"`
779+
// Unique identifier for the MCP tool call approval request. Include this value in
780+
// a subsequent `mcp_approval_response` input to approve or reject the
781+
// corresponding tool call.
782+
ApprovalRequestID string `json:"approval_request_id,nullable"`
780783
// The error from the tool call, if any.
781784
Error string `json:"error,nullable"`
782785
// The output from the tool call.
783786
Output string `json:"output,nullable"`
787+
// The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
788+
// `calling`, or `failed`.
789+
//
790+
// Any of "in_progress", "completed", "incomplete", "calling", "failed".
791+
Status string `json:"status"`
784792
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
785793
JSON struct {
786-
ID respjson.Field
787-
Arguments respjson.Field
788-
Name respjson.Field
789-
ServerLabel respjson.Field
790-
Type respjson.Field
791-
Error respjson.Field
792-
Output respjson.Field
793-
ExtraFields map[string]respjson.Field
794-
raw string
794+
ID respjson.Field
795+
Arguments respjson.Field
796+
Name respjson.Field
797+
ServerLabel respjson.Field
798+
Type respjson.Field
799+
ApprovalRequestID respjson.Field
800+
Error respjson.Field
801+
Output respjson.Field
802+
Status respjson.Field
803+
ExtraFields map[string]respjson.Field
804+
raw string
795805
} `json:"-"`
796806
}
797807

responses/response.go

Lines changed: 97 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6313,10 +6313,9 @@ type ResponseInputItemUnion struct {
63136313
Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
63146314
ServerLabel string `json:"server_label"`
63156315
// This field is from variant [ResponseInputItemMcpListTools].
6316-
Tools []ResponseInputItemMcpListToolsTool `json:"tools"`
6317-
Error string `json:"error"`
6318-
// This field is from variant [ResponseInputItemMcpApprovalResponse].
6319-
ApprovalRequestID string `json:"approval_request_id"`
6316+
Tools []ResponseInputItemMcpListToolsTool `json:"tools"`
6317+
Error string `json:"error"`
6318+
ApprovalRequestID string `json:"approval_request_id"`
63206319
// This field is from variant [ResponseInputItemMcpApprovalResponse].
63216320
Approve bool `json:"approve"`
63226321
// This field is from variant [ResponseInputItemMcpApprovalResponse].
@@ -7140,21 +7139,32 @@ type ResponseInputItemMcpCall struct {
71407139
ServerLabel string `json:"server_label,required"`
71417140
// The type of the item. Always `mcp_call`.
71427141
Type constant.McpCall `json:"type,required"`
7142+
// Unique identifier for the MCP tool call approval request. Include this value in
7143+
// a subsequent `mcp_approval_response` input to approve or reject the
7144+
// corresponding tool call.
7145+
ApprovalRequestID string `json:"approval_request_id,nullable"`
71437146
// The error from the tool call, if any.
71447147
Error string `json:"error,nullable"`
71457148
// The output from the tool call.
71467149
Output string `json:"output,nullable"`
7150+
// The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
7151+
// `calling`, or `failed`.
7152+
//
7153+
// Any of "in_progress", "completed", "incomplete", "calling", "failed".
7154+
Status string `json:"status"`
71477155
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
71487156
JSON struct {
7149-
ID respjson.Field
7150-
Arguments respjson.Field
7151-
Name respjson.Field
7152-
ServerLabel respjson.Field
7153-
Type respjson.Field
7154-
Error respjson.Field
7155-
Output respjson.Field
7156-
ExtraFields map[string]respjson.Field
7157-
raw string
7157+
ID respjson.Field
7158+
Arguments respjson.Field
7159+
Name respjson.Field
7160+
ServerLabel respjson.Field
7161+
Type respjson.Field
7162+
ApprovalRequestID respjson.Field
7163+
Error respjson.Field
7164+
Output respjson.Field
7165+
Status respjson.Field
7166+
ExtraFields map[string]respjson.Field
7167+
raw string
71587168
} `json:"-"`
71597169
}
71607170

@@ -7521,14 +7531,6 @@ func (u ResponseInputItemUnionParam) GetTools() []ResponseInputItemMcpListToolsT
75217531
return nil
75227532
}
75237533

7524-
// Returns a pointer to the underlying variant's property, if present.
7525-
func (u ResponseInputItemUnionParam) GetApprovalRequestID() *string {
7526-
if vt := u.OfMcpApprovalResponse; vt != nil {
7527-
return &vt.ApprovalRequestID
7528-
}
7529-
return nil
7530-
}
7531-
75327534
// Returns a pointer to the underlying variant's property, if present.
75337535
func (u ResponseInputItemUnionParam) GetApprove() *bool {
75347536
if vt := u.OfMcpApprovalResponse; vt != nil {
@@ -7641,6 +7643,8 @@ func (u ResponseInputItemUnionParam) GetStatus() *string {
76417643
return (*string)(&vt.Status)
76427644
} else if vt := u.OfLocalShellCallOutput; vt != nil {
76437645
return (*string)(&vt.Status)
7646+
} else if vt := u.OfMcpCall; vt != nil {
7647+
return (*string)(&vt.Status)
76447648
}
76457649
return nil
76467650
}
@@ -7757,6 +7761,16 @@ func (u ResponseInputItemUnionParam) GetError() *string {
77577761
return nil
77587762
}
77597763

7764+
// Returns a pointer to the underlying variant's property, if present.
7765+
func (u ResponseInputItemUnionParam) GetApprovalRequestID() *string {
7766+
if vt := u.OfMcpApprovalResponse; vt != nil {
7767+
return (*string)(&vt.ApprovalRequestID)
7768+
} else if vt := u.OfMcpCall; vt != nil && vt.ApprovalRequestID.Valid() {
7769+
return &vt.ApprovalRequestID.Value
7770+
}
7771+
return nil
7772+
}
7773+
77607774
// Returns a subunion which exports methods to access subproperties
77617775
//
77627776
// Or use AsAny() to get the underlying value
@@ -8424,10 +8438,19 @@ type ResponseInputItemMcpCallParam struct {
84248438
Name string `json:"name,required"`
84258439
// The label of the MCP server running the tool.
84268440
ServerLabel string `json:"server_label,required"`
8441+
// Unique identifier for the MCP tool call approval request. Include this value in
8442+
// a subsequent `mcp_approval_response` input to approve or reject the
8443+
// corresponding tool call.
8444+
ApprovalRequestID param.Opt[string] `json:"approval_request_id,omitzero"`
84278445
// The error from the tool call, if any.
84288446
Error param.Opt[string] `json:"error,omitzero"`
84298447
// The output from the tool call.
84308448
Output param.Opt[string] `json:"output,omitzero"`
8449+
// The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
8450+
// `calling`, or `failed`.
8451+
//
8452+
// Any of "in_progress", "completed", "incomplete", "calling", "failed".
8453+
Status string `json:"status,omitzero"`
84318454
// The type of the item. Always `mcp_call`.
84328455
//
84338456
// This field can be elided, and will marshal its zero value as "mcp_call".
@@ -8443,6 +8466,12 @@ func (r *ResponseInputItemMcpCallParam) UnmarshalJSON(data []byte) error {
84438466
return apijson.UnmarshalRoot(data, r)
84448467
}
84458468

8469+
func init() {
8470+
apijson.RegisterFieldValidator[ResponseInputItemMcpCallParam](
8471+
"status", "in_progress", "completed", "incomplete", "calling", "failed",
8472+
)
8473+
}
8474+
84468475
// An internal identifier for an item to reference.
84478476
//
84488477
// The property ID is required.
@@ -8689,10 +8718,9 @@ type ResponseItemUnion struct {
86898718
Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
86908719
ServerLabel string `json:"server_label"`
86918720
// This field is from variant [ResponseItemMcpListTools].
8692-
Tools []ResponseItemMcpListToolsTool `json:"tools"`
8693-
Error string `json:"error"`
8694-
// This field is from variant [ResponseItemMcpApprovalResponse].
8695-
ApprovalRequestID string `json:"approval_request_id"`
8721+
Tools []ResponseItemMcpListToolsTool `json:"tools"`
8722+
Error string `json:"error"`
8723+
ApprovalRequestID string `json:"approval_request_id"`
86968724
// This field is from variant [ResponseItemMcpApprovalResponse].
86978725
Approve bool `json:"approve"`
86988726
// This field is from variant [ResponseItemMcpApprovalResponse].
@@ -9275,21 +9303,32 @@ type ResponseItemMcpCall struct {
92759303
ServerLabel string `json:"server_label,required"`
92769304
// The type of the item. Always `mcp_call`.
92779305
Type constant.McpCall `json:"type,required"`
9306+
// Unique identifier for the MCP tool call approval request. Include this value in
9307+
// a subsequent `mcp_approval_response` input to approve or reject the
9308+
// corresponding tool call.
9309+
ApprovalRequestID string `json:"approval_request_id,nullable"`
92789310
// The error from the tool call, if any.
92799311
Error string `json:"error,nullable"`
92809312
// The output from the tool call.
92819313
Output string `json:"output,nullable"`
9314+
// The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
9315+
// `calling`, or `failed`.
9316+
//
9317+
// Any of "in_progress", "completed", "incomplete", "calling", "failed".
9318+
Status string `json:"status"`
92829319
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
92839320
JSON struct {
9284-
ID respjson.Field
9285-
Arguments respjson.Field
9286-
Name respjson.Field
9287-
ServerLabel respjson.Field
9288-
Type respjson.Field
9289-
Error respjson.Field
9290-
Output respjson.Field
9291-
ExtraFields map[string]respjson.Field
9292-
raw string
9321+
ID respjson.Field
9322+
Arguments respjson.Field
9323+
Name respjson.Field
9324+
ServerLabel respjson.Field
9325+
Type respjson.Field
9326+
ApprovalRequestID respjson.Field
9327+
Error respjson.Field
9328+
Output respjson.Field
9329+
Status respjson.Field
9330+
ExtraFields map[string]respjson.Field
9331+
raw string
92939332
} `json:"-"`
92949333
}
92959334

@@ -9574,7 +9613,9 @@ type ResponseOutputItemUnion struct {
95749613
// This field is from variant [ResponseCodeInterpreterToolCall].
95759614
Outputs []ResponseCodeInterpreterToolCallOutputUnion `json:"outputs"`
95769615
ServerLabel string `json:"server_label"`
9577-
Error string `json:"error"`
9616+
// This field is from variant [ResponseOutputItemMcpCall].
9617+
ApprovalRequestID string `json:"approval_request_id"`
9618+
Error string `json:"error"`
95789619
// This field is from variant [ResponseOutputItemMcpCall].
95799620
Output string `json:"output"`
95809621
// This field is from variant [ResponseOutputItemMcpListTools].
@@ -9601,6 +9642,7 @@ type ResponseOutputItemUnion struct {
96019642
ContainerID respjson.Field
96029643
Outputs respjson.Field
96039644
ServerLabel respjson.Field
9645+
ApprovalRequestID respjson.Field
96049646
Error respjson.Field
96059647
Output respjson.Field
96069648
Tools respjson.Field
@@ -9953,21 +9995,32 @@ type ResponseOutputItemMcpCall struct {
99539995
ServerLabel string `json:"server_label,required"`
99549996
// The type of the item. Always `mcp_call`.
99559997
Type constant.McpCall `json:"type,required"`
9998+
// Unique identifier for the MCP tool call approval request. Include this value in
9999+
// a subsequent `mcp_approval_response` input to approve or reject the
10000+
// corresponding tool call.
10001+
ApprovalRequestID string `json:"approval_request_id,nullable"`
995610002
// The error from the tool call, if any.
995710003
Error string `json:"error,nullable"`
995810004
// The output from the tool call.
995910005
Output string `json:"output,nullable"`
10006+
// The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
10007+
// `calling`, or `failed`.
10008+
//
10009+
// Any of "in_progress", "completed", "incomplete", "calling", "failed".
10010+
Status string `json:"status"`
996010011
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
996110012
JSON struct {
9962-
ID respjson.Field
9963-
Arguments respjson.Field
9964-
Name respjson.Field
9965-
ServerLabel respjson.Field
9966-
Type respjson.Field
9967-
Error respjson.Field
9968-
Output respjson.Field
9969-
ExtraFields map[string]respjson.Field
9970-
raw string
10013+
ID respjson.Field
10014+
Arguments respjson.Field
10015+
Name respjson.Field
10016+
ServerLabel respjson.Field
10017+
Type respjson.Field
10018+
ApprovalRequestID respjson.Field
10019+
Error respjson.Field
10020+
Output respjson.Field
10021+
Status respjson.Field
10022+
ExtraFields map[string]respjson.Field
10023+
raw string
997110024
} `json:"-"`
997210025
}
997310026

0 commit comments

Comments
 (0)