Skip to content

Commit 8910a12

Browse files
feat(api)!: use input_schema instead of parameters for tools
1 parent 25a0f10 commit 8910a12

File tree

6 files changed

+181
-104
lines changed

6 files changed

+181
-104
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 109
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-4337a6181c2db17737133e944b4b660a5e00ea10dce6be3252918e39451e9b5f.yml
3-
openapi_spec_hash: a0bc8f4b5f45bc5741fed8eaa61171c3
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-5f0f0b99d1b0bf40e00e11f5d134ed13de97799cf2dfea0c8612e2f003584505.yml
3+
openapi_spec_hash: 5f51544cb340c37aba54b93a526c536e
44
config_hash: 0412cd40c0609550c1a47c69dd104e4f

src/resources/responses/input-items.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export interface InputItemListResponse {
3838
| InputItemListResponse.OpenAIResponseOutputMessageFileSearchToolCall
3939
| InputItemListResponse.OpenAIResponseOutputMessageFunctionToolCall
4040
| InputItemListResponse.OpenAIResponseInputFunctionToolCallOutput
41+
| InputItemListResponse.OpenAIResponseMcpApprovalRequest
42+
| InputItemListResponse.OpenAIResponseMcpApprovalResponse
4143
| InputItemListResponse.OpenAIResponseMessage
4244
>;
4345

@@ -181,6 +183,36 @@ export namespace InputItemListResponse {
181183
status?: string;
182184
}
183185

186+
/**
187+
* A request for human approval of a tool invocation.
188+
*/
189+
export interface OpenAIResponseMcpApprovalRequest {
190+
id: string;
191+
192+
arguments: string;
193+
194+
name: string;
195+
196+
server_label: string;
197+
198+
type: 'mcp_approval_request';
199+
}
200+
201+
/**
202+
* A response to an MCP approval request.
203+
*/
204+
export interface OpenAIResponseMcpApprovalResponse {
205+
approval_request_id: string;
206+
207+
approve: boolean;
208+
209+
type: 'mcp_approval_response';
210+
211+
id?: string;
212+
213+
reason?: string;
214+
}
215+
184216
/**
185217
* Corresponds to the various Message types in the Responses API. They are all
186218
* under one type because the Responses API gives them all the same "type" value,

src/resources/responses/responses.ts

Lines changed: 130 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export interface ResponseObject {
108108
| ResponseObject.OpenAIResponseOutputMessageFunctionToolCall
109109
| ResponseObject.OpenAIResponseOutputMessageMcpCall
110110
| ResponseObject.OpenAIResponseOutputMessageMcpListTools
111+
| ResponseObject.OpenAIResponseMcpApprovalRequest
111112
>;
112113

113114
/**
@@ -508,6 +509,21 @@ export namespace ResponseObject {
508509
}
509510
}
510511

512+
/**
513+
* A request for human approval of a tool invocation.
514+
*/
515+
export interface OpenAIResponseMcpApprovalRequest {
516+
id: string;
517+
518+
arguments: string;
519+
520+
name: string;
521+
522+
server_label: string;
523+
524+
type: 'mcp_approval_request';
525+
}
526+
511527
/**
512528
* Text formatting configuration for the response
513529
*/
@@ -623,7 +639,8 @@ export namespace ResponseObjectStream {
623639
| OpenAIResponseObjectStreamResponseOutputItemAdded.OpenAIResponseOutputMessageFileSearchToolCall
624640
| OpenAIResponseObjectStreamResponseOutputItemAdded.OpenAIResponseOutputMessageFunctionToolCall
625641
| OpenAIResponseObjectStreamResponseOutputItemAdded.OpenAIResponseOutputMessageMcpCall
626-
| OpenAIResponseObjectStreamResponseOutputItemAdded.OpenAIResponseOutputMessageMcpListTools;
642+
| OpenAIResponseObjectStreamResponseOutputItemAdded.OpenAIResponseOutputMessageMcpListTools
643+
| OpenAIResponseObjectStreamResponseOutputItemAdded.OpenAIResponseMcpApprovalRequest;
627644

628645
/**
629646
* Index position of this item in the output list
@@ -1002,6 +1019,21 @@ export namespace ResponseObjectStream {
10021019
description?: string;
10031020
}
10041021
}
1022+
1023+
/**
1024+
* A request for human approval of a tool invocation.
1025+
*/
1026+
export interface OpenAIResponseMcpApprovalRequest {
1027+
id: string;
1028+
1029+
arguments: string;
1030+
1031+
name: string;
1032+
1033+
server_label: string;
1034+
1035+
type: 'mcp_approval_request';
1036+
}
10051037
}
10061038

10071039
/**
@@ -1017,7 +1049,8 @@ export namespace ResponseObjectStream {
10171049
| OpenAIResponseObjectStreamResponseOutputItemDone.OpenAIResponseOutputMessageFileSearchToolCall
10181050
| OpenAIResponseObjectStreamResponseOutputItemDone.OpenAIResponseOutputMessageFunctionToolCall
10191051
| OpenAIResponseObjectStreamResponseOutputItemDone.OpenAIResponseOutputMessageMcpCall
1020-
| OpenAIResponseObjectStreamResponseOutputItemDone.OpenAIResponseOutputMessageMcpListTools;
1052+
| OpenAIResponseObjectStreamResponseOutputItemDone.OpenAIResponseOutputMessageMcpListTools
1053+
| OpenAIResponseObjectStreamResponseOutputItemDone.OpenAIResponseMcpApprovalRequest;
10211054

10221055
/**
10231056
* Index position of this item in the output list
@@ -1396,6 +1429,21 @@ export namespace ResponseObjectStream {
13961429
description?: string;
13971430
}
13981431
}
1432+
1433+
/**
1434+
* A request for human approval of a tool invocation.
1435+
*/
1436+
export interface OpenAIResponseMcpApprovalRequest {
1437+
id: string;
1438+
1439+
arguments: string;
1440+
1441+
name: string;
1442+
1443+
server_label: string;
1444+
1445+
type: 'mcp_approval_request';
1446+
}
13991447
}
14001448

14011449
/**
@@ -1815,6 +1863,8 @@ export interface ResponseListResponse {
18151863
| ResponseListResponse.OpenAIResponseOutputMessageFileSearchToolCall
18161864
| ResponseListResponse.OpenAIResponseOutputMessageFunctionToolCall
18171865
| ResponseListResponse.OpenAIResponseInputFunctionToolCallOutput
1866+
| ResponseListResponse.OpenAIResponseMcpApprovalRequest
1867+
| ResponseListResponse.OpenAIResponseMcpApprovalResponse
18181868
| ResponseListResponse.OpenAIResponseMessage
18191869
>;
18201870

@@ -1838,6 +1888,7 @@ export interface ResponseListResponse {
18381888
| ResponseListResponse.OpenAIResponseOutputMessageFunctionToolCall
18391889
| ResponseListResponse.OpenAIResponseOutputMessageMcpCall
18401890
| ResponseListResponse.OpenAIResponseOutputMessageMcpListTools
1891+
| ResponseListResponse.OpenAIResponseMcpApprovalRequest
18411892
>;
18421893

18431894
/**
@@ -2015,6 +2066,36 @@ export namespace ResponseListResponse {
20152066
status?: string;
20162067
}
20172068

2069+
/**
2070+
* A request for human approval of a tool invocation.
2071+
*/
2072+
export interface OpenAIResponseMcpApprovalRequest {
2073+
id: string;
2074+
2075+
arguments: string;
2076+
2077+
name: string;
2078+
2079+
server_label: string;
2080+
2081+
type: 'mcp_approval_request';
2082+
}
2083+
2084+
/**
2085+
* A response to an MCP approval request.
2086+
*/
2087+
export interface OpenAIResponseMcpApprovalResponse {
2088+
approval_request_id: string;
2089+
2090+
approve: boolean;
2091+
2092+
type: 'mcp_approval_response';
2093+
2094+
id?: string;
2095+
2096+
reason?: string;
2097+
}
2098+
20182099
/**
20192100
* Corresponds to the various Message types in the Responses API. They are all
20202101
* under one type because the Responses API gives them all the same "type" value,
@@ -2523,6 +2604,21 @@ export namespace ResponseListResponse {
25232604
}
25242605
}
25252606

2607+
/**
2608+
* A request for human approval of a tool invocation.
2609+
*/
2610+
export interface OpenAIResponseMcpApprovalRequest {
2611+
id: string;
2612+
2613+
arguments: string;
2614+
2615+
name: string;
2616+
2617+
server_label: string;
2618+
2619+
type: 'mcp_approval_request';
2620+
}
2621+
25262622
/**
25272623
* Text formatting configuration for the response
25282624
*/
@@ -2616,6 +2712,8 @@ export interface ResponseCreateParamsBase {
26162712
| ResponseCreateParams.OpenAIResponseOutputMessageFileSearchToolCall
26172713
| ResponseCreateParams.OpenAIResponseOutputMessageFunctionToolCall
26182714
| ResponseCreateParams.OpenAIResponseInputFunctionToolCallOutput
2715+
| ResponseCreateParams.OpenAIResponseMcpApprovalRequest
2716+
| ResponseCreateParams.OpenAIResponseMcpApprovalResponse
26192717
| ResponseCreateParams.OpenAIResponseMessage
26202718
>;
26212719

@@ -2793,6 +2891,36 @@ export namespace ResponseCreateParams {
27932891
status?: string;
27942892
}
27952893

2894+
/**
2895+
* A request for human approval of a tool invocation.
2896+
*/
2897+
export interface OpenAIResponseMcpApprovalRequest {
2898+
id: string;
2899+
2900+
arguments: string;
2901+
2902+
name: string;
2903+
2904+
server_label: string;
2905+
2906+
type: 'mcp_approval_request';
2907+
}
2908+
2909+
/**
2910+
* A response to an MCP approval request.
2911+
*/
2912+
export interface OpenAIResponseMcpApprovalResponse {
2913+
approval_request_id: string;
2914+
2915+
approve: boolean;
2916+
2917+
type: 'mcp_approval_response';
2918+
2919+
id?: string;
2920+
2921+
reason?: string;
2922+
}
2923+
27962924
/**
27972925
* Corresponds to the various Message types in the Responses API. They are all
27982926
* under one type because the Responses API gives them all the same "type" value,

src/resources/tool-runtime/tool-runtime.ts

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -58,56 +58,19 @@ export interface ToolDef {
5858
description?: string;
5959

6060
/**
61-
* (Optional) Additional metadata about the tool
61+
* (Optional) JSON Schema for tool inputs (MCP inputSchema)
6262
*/
63-
metadata?: { [key: string]: boolean | number | string | Array<unknown> | unknown | null };
63+
input_schema?: { [key: string]: boolean | number | string | Array<unknown> | unknown | null };
6464

6565
/**
66-
* (Optional) List of parameters this tool accepts
66+
* (Optional) Additional metadata about the tool
6767
*/
68-
parameters?: Array<ToolDef.Parameter>;
69-
}
68+
metadata?: { [key: string]: boolean | number | string | Array<unknown> | unknown | null };
7069

71-
export namespace ToolDef {
7270
/**
73-
* Parameter definition for a tool.
71+
* (Optional) JSON Schema for tool outputs (MCP outputSchema)
7472
*/
75-
export interface Parameter {
76-
/**
77-
* Human-readable description of what the parameter does
78-
*/
79-
description: string;
80-
81-
/**
82-
* Name of the parameter
83-
*/
84-
name: string;
85-
86-
/**
87-
* Type of the parameter (e.g., string, integer)
88-
*/
89-
parameter_type: string;
90-
91-
/**
92-
* Whether this parameter is required for tool invocation
93-
*/
94-
required: boolean;
95-
96-
/**
97-
* (Optional) Default value for the parameter if not provided
98-
*/
99-
default?: boolean | number | string | Array<unknown> | unknown | null;
100-
101-
/**
102-
* Type of the elements when parameter_type is array
103-
*/
104-
items?: unknown;
105-
106-
/**
107-
* (Optional) Title of the parameter
108-
*/
109-
title?: string;
110-
}
73+
output_schema?: { [key: string]: boolean | number | string | Array<unknown> | unknown | null };
11174
}
11275

11376
/**

0 commit comments

Comments
 (0)