codex-rs: add tool search inspector API

This commit is contained in:
Steven Lee
2026-06-25 19:37:17 +00:00
parent 322e33512b
commit dd64a9a6e6
20 changed files with 786 additions and 6 deletions
@@ -19660,6 +19660,111 @@
],
"type": "object"
},
"ToolSearchInspectOutputTool": {
"properties": {
"namespace": {
"type": [
"string",
"null"
]
},
"toolNames": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"toolNames"
],
"type": "object"
},
"ToolSearchInspectResult": {
"properties": {
"index": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"rank": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"score": {
"format": "float",
"type": [
"number",
"null"
]
},
"searchableText": {
"type": "string"
},
"source": {
"anyOf": [
{
"$ref": "#/definitions/v2/ToolSearchInspectSource"
},
{
"type": "null"
}
]
},
"tools": {
"items": {
"$ref": "#/definitions/v2/ToolSearchInspectTool"
},
"type": "array"
}
},
"required": [
"index",
"rank",
"searchableText",
"tools"
],
"type": "object"
},
"ToolSearchInspectSource": {
"properties": {
"description": {
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"ToolSearchInspectTool": {
"properties": {
"canonicalName": {
"type": "string"
},
"name": {
"type": "string"
},
"namespace": {
"type": [
"string",
"null"
]
}
},
"required": [
"canonicalName",
"name"
],
"type": "object"
},
"ToolsV2": {
"properties": {
"web_search": {
@@ -17439,6 +17439,111 @@
],
"type": "object"
},
"ToolSearchInspectOutputTool": {
"properties": {
"namespace": {
"type": [
"string",
"null"
]
},
"toolNames": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"toolNames"
],
"type": "object"
},
"ToolSearchInspectResult": {
"properties": {
"index": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"rank": {
"format": "uint32",
"minimum": 0.0,
"type": "integer"
},
"score": {
"format": "float",
"type": [
"number",
"null"
]
},
"searchableText": {
"type": "string"
},
"source": {
"anyOf": [
{
"$ref": "#/definitions/ToolSearchInspectSource"
},
{
"type": "null"
}
]
},
"tools": {
"items": {
"$ref": "#/definitions/ToolSearchInspectTool"
},
"type": "array"
}
},
"required": [
"index",
"rank",
"searchableText",
"tools"
],
"type": "object"
},
"ToolSearchInspectSource": {
"properties": {
"description": {
"type": [
"string",
"null"
]
},
"name": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
},
"ToolSearchInspectTool": {
"properties": {
"canonicalName": {
"type": "string"
},
"name": {
"type": "string"
},
"namespace": {
"type": [
"string",
"null"
]
}
},
"required": [
"canonicalName",
"name"
],
"type": "object"
},
"ToolsV2": {
"properties": {
"web_search": {
@@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ToolSearchInspectOutputTool = { namespace: string | null, toolNames: Array<string>, };
@@ -0,0 +1,7 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ToolSearchInspectSource } from "./ToolSearchInspectSource";
import type { ToolSearchInspectTool } from "./ToolSearchInspectTool";
export type ToolSearchInspectResult = { rank: number, index: number, score: number | null, source: ToolSearchInspectSource | null, tools: Array<ToolSearchInspectTool>, searchableText: string, };
@@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ToolSearchInspectSource = { name: string, description: string | null, };
@@ -0,0 +1,5 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type ToolSearchInspectTool = { namespace: string | null, name: string, canonicalName: string, };
@@ -466,6 +466,10 @@ export type { ToolRequestUserInputOption } from "./ToolRequestUserInputOption";
export type { ToolRequestUserInputParams } from "./ToolRequestUserInputParams";
export type { ToolRequestUserInputQuestion } from "./ToolRequestUserInputQuestion";
export type { ToolRequestUserInputResponse } from "./ToolRequestUserInputResponse";
export type { ToolSearchInspectOutputTool } from "./ToolSearchInspectOutputTool";
export type { ToolSearchInspectResult } from "./ToolSearchInspectResult";
export type { ToolSearchInspectSource } from "./ToolSearchInspectSource";
export type { ToolSearchInspectTool } from "./ToolSearchInspectTool";
export type { ToolsV2 } from "./ToolsV2";
export type { Turn } from "./Turn";
export type { TurnCompletedNotification } from "./TurnCompletedNotification";
@@ -961,6 +961,12 @@ client_request_definitions! {
serialization: global("mcp-registry"),
response: v2::ListMcpServerStatusResponse,
},
#[experimental("toolSearch/inspect")]
ToolSearchInspect => "toolSearch/inspect" {
params: v2::ToolSearchInspectParams,
serialization: thread_id(params.thread_id),
response: v2::ToolSearchInspectResponse,
},
McpResourceRead => "mcpServer/resource/read" {
params: v2::McpResourceReadParams,
@@ -24,6 +24,7 @@ mod remote_control;
mod review;
mod thread;
mod thread_data;
mod tool_search;
mod turn;
mod windows_sandbox;
@@ -52,6 +53,7 @@ pub use review::*;
pub use shared::*;
pub use thread::*;
pub use thread_data::*;
pub use tool_search::*;
pub use turn::*;
pub use windows_sandbox::*;
@@ -0,0 +1,65 @@
use schemars::JsonSchema;
use serde::Deserialize;
use serde::Serialize;
use ts_rs::TS;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ToolSearchInspectParams {
pub thread_id: String,
pub query: String,
/// Optional result limit. Defaults to the runtime `tool_search` default.
#[ts(optional = nullable)]
pub limit: Option<u32>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ToolSearchInspectResponse {
pub indexed_tool_count: u32,
pub matching_tool_count: u32,
pub requested_limit: u32,
pub effective_limit: u32,
pub top_k_truncated: bool,
pub results: Vec<ToolSearchInspectResult>,
pub output_tools: Vec<ToolSearchInspectOutputTool>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ToolSearchInspectResult {
pub rank: u32,
pub index: u32,
pub score: Option<f32>,
pub source: Option<ToolSearchInspectSource>,
pub tools: Vec<ToolSearchInspectTool>,
pub searchable_text: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ToolSearchInspectSource {
pub name: String,
pub description: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ToolSearchInspectTool {
pub namespace: Option<String>,
pub name: String,
pub canonical_name: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ToolSearchInspectOutputTool {
pub namespace: Option<String>,
pub tool_names: Vec<String>,
}