Skip to content

Commit 2ad3535

Browse files
fix(api): fix mcp tool name
1 parent e22cdc5 commit 2ad3535

13 files changed

+56
-68
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: 118
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ea23db36b0899cc715f56d0098956069b2d92880f448adff3a4ac1bb53cb2cec.yml
3-
openapi_spec_hash: 36f76ea31297c9593bcfae453f6255cc
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-65d42621b731238ad4e59a35a705fc0608b17f53a14d047e66ce480c793da26b.yml
3+
openapi_spec_hash: d7ca86b2507600cbd5ed197cf31263c2
44
config_hash: 666d6bb4b564f0d9d431124b5d1a0665

openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItem.kt

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private constructor(
3434
private val functionCallOutput: RealtimeConversationItemFunctionCallOutput? = null,
3535
private val mcpApprovalResponse: RealtimeMcpApprovalResponse? = null,
3636
private val mcpListTools: RealtimeMcpListTools? = null,
37-
private val mcpToolCall: RealtimeMcpToolCall? = null,
37+
private val mcpCall: RealtimeMcpToolCall? = null,
3838
private val mcpApprovalRequest: RealtimeMcpApprovalRequest? = null,
3939
private val _json: JsonValue? = null,
4040
) {
@@ -74,7 +74,7 @@ private constructor(
7474
fun mcpListTools(): Optional<RealtimeMcpListTools> = Optional.ofNullable(mcpListTools)
7575

7676
/** A Realtime item representing an invocation of a tool on an MCP server. */
77-
fun mcpToolCall(): Optional<RealtimeMcpToolCall> = Optional.ofNullable(mcpToolCall)
77+
fun mcpCall(): Optional<RealtimeMcpToolCall> = Optional.ofNullable(mcpCall)
7878

7979
/** A Realtime item requesting human approval of a tool invocation. */
8080
fun mcpApprovalRequest(): Optional<RealtimeMcpApprovalRequest> =
@@ -97,7 +97,7 @@ private constructor(
9797

9898
fun isMcpListTools(): Boolean = mcpListTools != null
9999

100-
fun isMcpToolCall(): Boolean = mcpToolCall != null
100+
fun isMcpCall(): Boolean = mcpCall != null
101101

102102
fun isMcpApprovalRequest(): Boolean = mcpApprovalRequest != null
103103

@@ -137,7 +137,7 @@ private constructor(
137137
fun asMcpListTools(): RealtimeMcpListTools = mcpListTools.getOrThrow("mcpListTools")
138138

139139
/** A Realtime item representing an invocation of a tool on an MCP server. */
140-
fun asMcpToolCall(): RealtimeMcpToolCall = mcpToolCall.getOrThrow("mcpToolCall")
140+
fun asMcpCall(): RealtimeMcpToolCall = mcpCall.getOrThrow("mcpCall")
141141

142142
/** A Realtime item requesting human approval of a tool invocation. */
143143
fun asMcpApprovalRequest(): RealtimeMcpApprovalRequest =
@@ -163,7 +163,7 @@ private constructor(
163163
functionCallOutput != null -> visitor.visitFunctionCallOutput(functionCallOutput)
164164
mcpApprovalResponse != null -> visitor.visitMcpApprovalResponse(mcpApprovalResponse)
165165
mcpListTools != null -> visitor.visitMcpListTools(mcpListTools)
166-
mcpToolCall != null -> visitor.visitMcpToolCall(mcpToolCall)
166+
mcpCall != null -> visitor.visitMcpCall(mcpCall)
167167
mcpApprovalRequest != null -> visitor.visitMcpApprovalRequest(mcpApprovalRequest)
168168
else -> visitor.unknown(_json)
169169
}
@@ -216,8 +216,8 @@ private constructor(
216216
mcpListTools.validate()
217217
}
218218

219-
override fun visitMcpToolCall(mcpToolCall: RealtimeMcpToolCall) {
220-
mcpToolCall.validate()
219+
override fun visitMcpCall(mcpCall: RealtimeMcpToolCall) {
220+
mcpCall.validate()
221221
}
222222

223223
override fun visitMcpApprovalRequest(
@@ -274,8 +274,7 @@ private constructor(
274274
override fun visitMcpListTools(mcpListTools: RealtimeMcpListTools) =
275275
mcpListTools.validity()
276276

277-
override fun visitMcpToolCall(mcpToolCall: RealtimeMcpToolCall) =
278-
mcpToolCall.validity()
277+
override fun visitMcpCall(mcpCall: RealtimeMcpToolCall) = mcpCall.validity()
279278

280279
override fun visitMcpApprovalRequest(
281280
mcpApprovalRequest: RealtimeMcpApprovalRequest
@@ -299,7 +298,7 @@ private constructor(
299298
functionCallOutput == other.functionCallOutput &&
300299
mcpApprovalResponse == other.mcpApprovalResponse &&
301300
mcpListTools == other.mcpListTools &&
302-
mcpToolCall == other.mcpToolCall &&
301+
mcpCall == other.mcpCall &&
303302
mcpApprovalRequest == other.mcpApprovalRequest
304303
}
305304

@@ -312,7 +311,7 @@ private constructor(
312311
functionCallOutput,
313312
mcpApprovalResponse,
314313
mcpListTools,
315-
mcpToolCall,
314+
mcpCall,
316315
mcpApprovalRequest,
317316
)
318317

@@ -329,7 +328,7 @@ private constructor(
329328
mcpApprovalResponse != null ->
330329
"ConversationItem{mcpApprovalResponse=$mcpApprovalResponse}"
331330
mcpListTools != null -> "ConversationItem{mcpListTools=$mcpListTools}"
332-
mcpToolCall != null -> "ConversationItem{mcpToolCall=$mcpToolCall}"
331+
mcpCall != null -> "ConversationItem{mcpCall=$mcpCall}"
333332
mcpApprovalRequest != null -> "ConversationItem{mcpApprovalRequest=$mcpApprovalRequest}"
334333
_json != null -> "ConversationItem{_unknown=$_json}"
335334
else -> throw IllegalStateException("Invalid ConversationItem")
@@ -392,9 +391,7 @@ private constructor(
392391
ConversationItem(mcpListTools = mcpListTools)
393392

394393
/** A Realtime item representing an invocation of a tool on an MCP server. */
395-
@JvmStatic
396-
fun ofMcpToolCall(mcpToolCall: RealtimeMcpToolCall) =
397-
ConversationItem(mcpToolCall = mcpToolCall)
394+
@JvmStatic fun ofMcpCall(mcpCall: RealtimeMcpToolCall) = ConversationItem(mcpCall = mcpCall)
398395

399396
/** A Realtime item requesting human approval of a tool invocation. */
400397
@JvmStatic
@@ -445,7 +442,7 @@ private constructor(
445442
fun visitMcpListTools(mcpListTools: RealtimeMcpListTools): T
446443

447444
/** A Realtime item representing an invocation of a tool on an MCP server. */
448-
fun visitMcpToolCall(mcpToolCall: RealtimeMcpToolCall): T
445+
fun visitMcpCall(mcpCall: RealtimeMcpToolCall): T
449446

450447
/** A Realtime item requesting human approval of a tool invocation. */
451448
fun visitMcpApprovalRequest(mcpApprovalRequest: RealtimeMcpApprovalRequest): T
@@ -546,9 +543,9 @@ private constructor(
546543
ConversationItem(mcpListTools = it, _json = json)
547544
} ?: ConversationItem(_json = json)
548545
}
549-
"mcp_tool_call" -> {
546+
"mcp_call" -> {
550547
return tryDeserialize(node, jacksonTypeRef<RealtimeMcpToolCall>())?.let {
551-
ConversationItem(mcpToolCall = it, _json = json)
548+
ConversationItem(mcpCall = it, _json = json)
552549
} ?: ConversationItem(_json = json)
553550
}
554551
"mcp_approval_request" -> {
@@ -581,7 +578,7 @@ private constructor(
581578
value.mcpApprovalResponse != null ->
582579
generator.writeObject(value.mcpApprovalResponse)
583580
value.mcpListTools != null -> generator.writeObject(value.mcpListTools)
584-
value.mcpToolCall != null -> generator.writeObject(value.mcpToolCall)
581+
value.mcpCall != null -> generator.writeObject(value.mcpCall)
585582
value.mcpApprovalRequest != null -> generator.writeObject(value.mcpApprovalRequest)
586583
value._json != null -> generator.writeObject(value._json)
587584
else -> throw IllegalStateException("Invalid ConversationItem")

openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemAdded.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,8 @@ private constructor(
271271
fun item(mcpListTools: RealtimeMcpListTools) =
272272
item(ConversationItem.ofMcpListTools(mcpListTools))
273273

274-
/** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */
275-
fun item(mcpToolCall: RealtimeMcpToolCall) =
276-
item(ConversationItem.ofMcpToolCall(mcpToolCall))
274+
/** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */
275+
fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall))
277276

278277
/**
279278
* Alias for calling [item] with

openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreateEvent.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,8 @@ private constructor(
257257
fun item(mcpListTools: RealtimeMcpListTools) =
258258
item(ConversationItem.ofMcpListTools(mcpListTools))
259259

260-
/** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */
261-
fun item(mcpToolCall: RealtimeMcpToolCall) =
262-
item(ConversationItem.ofMcpToolCall(mcpToolCall))
260+
/** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */
261+
fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall))
263262

264263
/**
265264
* Alias for calling [item] with

openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreatedEvent.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,8 @@ private constructor(
267267
fun item(mcpListTools: RealtimeMcpListTools) =
268268
item(ConversationItem.ofMcpListTools(mcpListTools))
269269

270-
/** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */
271-
fun item(mcpToolCall: RealtimeMcpToolCall) =
272-
item(ConversationItem.ofMcpToolCall(mcpToolCall))
270+
/** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */
271+
fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall))
273272

274273
/**
275274
* Alias for calling [item] with

openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDone.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,8 @@ private constructor(
263263
fun item(mcpListTools: RealtimeMcpListTools) =
264264
item(ConversationItem.ofMcpListTools(mcpListTools))
265265

266-
/** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */
267-
fun item(mcpToolCall: RealtimeMcpToolCall) =
268-
item(ConversationItem.ofMcpToolCall(mcpToolCall))
266+
/** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */
267+
fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall))
269268

270269
/**
271270
* Alias for calling [item] with

openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolCall.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ private constructor(
100100
fun serverLabel(): String = serverLabel.getRequired("server_label")
101101

102102
/**
103-
* The type of the item. Always `mcp_tool_call`.
103+
* The type of the item. Always `mcp_call`.
104104
*
105105
* Expected to always return the following:
106106
* ```java
107-
* JsonValue.from("mcp_tool_call")
107+
* JsonValue.from("mcp_call")
108108
* ```
109109
*
110110
* However, this method can be useful for debugging and logging (e.g. if the server responded
@@ -225,7 +225,7 @@ private constructor(
225225
private var arguments: JsonField<String>? = null
226226
private var name: JsonField<String>? = null
227227
private var serverLabel: JsonField<String>? = null
228-
private var type: JsonValue = JsonValue.from("mcp_tool_call")
228+
private var type: JsonValue = JsonValue.from("mcp_call")
229229
private var approvalRequestId: JsonField<String> = JsonMissing.of()
230230
private var error: JsonField<Error> = JsonMissing.of()
231231
private var output: JsonField<String> = JsonMissing.of()
@@ -296,7 +296,7 @@ private constructor(
296296
* It is usually unnecessary to call this method because the field defaults to the
297297
* following:
298298
* ```java
299-
* JsonValue.from("mcp_tool_call")
299+
* JsonValue.from("mcp_call")
300300
* ```
301301
*
302302
* This method is primarily for setting the field to an undocumented or not yet supported
@@ -432,7 +432,7 @@ private constructor(
432432
name()
433433
serverLabel()
434434
_type().let {
435-
if (it != JsonValue.from("mcp_tool_call")) {
435+
if (it != JsonValue.from("mcp_call")) {
436436
throw OpenAIInvalidDataException("'type' is invalid, received $it")
437437
}
438438
}
@@ -461,7 +461,7 @@ private constructor(
461461
(if (arguments.asKnown().isPresent) 1 else 0) +
462462
(if (name.asKnown().isPresent) 1 else 0) +
463463
(if (serverLabel.asKnown().isPresent) 1 else 0) +
464-
type.let { if (it == JsonValue.from("mcp_tool_call")) 1 else 0 } +
464+
type.let { if (it == JsonValue.from("mcp_call")) 1 else 0 } +
465465
(if (approvalRequestId.asKnown().isPresent) 1 else 0) +
466466
(error.asKnown().getOrNull()?.validity() ?: 0) +
467467
(if (output.asKnown().isPresent) 1 else 0)

openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponse.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,8 @@ private constructor(
553553
fun addOutput(mcpListTools: RealtimeMcpListTools) =
554554
addOutput(ConversationItem.ofMcpListTools(mcpListTools))
555555

556-
/** Alias for calling [addOutput] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */
557-
fun addOutput(mcpToolCall: RealtimeMcpToolCall) =
558-
addOutput(ConversationItem.ofMcpToolCall(mcpToolCall))
556+
/** Alias for calling [addOutput] with `ConversationItem.ofMcpCall(mcpCall)`. */
557+
fun addOutput(mcpCall: RealtimeMcpToolCall) = addOutput(ConversationItem.ofMcpCall(mcpCall))
559558

560559
/**
561560
* Alias for calling [addOutput] with

openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,8 @@ private constructor(
498498
fun addInput(mcpListTools: RealtimeMcpListTools) =
499499
addInput(ConversationItem.ofMcpListTools(mcpListTools))
500500

501-
/** Alias for calling [addInput] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */
502-
fun addInput(mcpToolCall: RealtimeMcpToolCall) =
503-
addInput(ConversationItem.ofMcpToolCall(mcpToolCall))
501+
/** Alias for calling [addInput] with `ConversationItem.ofMcpCall(mcpCall)`. */
502+
fun addInput(mcpCall: RealtimeMcpToolCall) = addInput(ConversationItem.ofMcpCall(mcpCall))
504503

505504
/**
506505
* Alias for calling [addInput] with

openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3038,9 +3038,8 @@ private constructor(
30383038
fun item(mcpListTools: RealtimeMcpListTools) =
30393039
item(ConversationItem.ofMcpListTools(mcpListTools))
30403040

3041-
/** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */
3042-
fun item(mcpToolCall: RealtimeMcpToolCall) =
3043-
item(ConversationItem.ofMcpToolCall(mcpToolCall))
3041+
/** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */
3042+
fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall))
30443043

30453044
/**
30463045
* Alias for calling [item] with

0 commit comments

Comments
 (0)