Files
codex/codex-rs/tools/Cargo.toml
T
Dmitriy Kovalenko 4c153c26c0 Reduce allocations when preparing tool schemas and catalogs (#62849)
## Why

Tool schema budget checks cloned the schema and allocated a JSON buffer
just to measure its size. Building a Responses Lite catalog also cloned
tool definitions before serializing them.

## What changed

- Deserialize schemas from borrowed JSON during compaction, count
  serialized bytes without allocating a buffer, and reuse the parsed
  schema when it fits the budget.
- Serialize borrowed tool specs and namespace members directly, and pass
  filtered specs as an iterator. Preserve the serialized namespace field
  order because the bytes contribute to the `additional_tools` item ID.

## Testing

- Compare the exact serialized Responses Lite catalog against the
  expected namespace layout.
- Add a `tool_catalog` benchmark for connector schema preparation and
  Responses Lite catalog encoding with 1 and 64 tool specs.

GitOrigin-RevId: 6bd03a12fcedd4abfa8c3a03f298243483e98c63
2026-11-20 22:10:45 +00:00

46 lines
1.2 KiB
TOML

[package]
edition.workspace = true
license.workspace = true
name = "codex-tools"
version.workspace = true
[lints]
workspace = true
[dependencies]
bitflags = { workspace = true }
codex-attachment-store = { workspace = true }
codex-code-mode = { workspace = true }
codex-connectors = { workspace = true }
codex-features = { workspace = true }
codex-file-system = { workspace = true }
codex-extension-items = { workspace = true }
codex-protocol = { workspace = true }
codex-utils-output-truncation = { workspace = true }
codex-utils-path-uri = { workspace = true }
codex-utils-string = { workspace = true }
jsonptr = { workspace = true }
rmcp = { workspace = true, default-features = false, features = [
"base64",
"macros",
"schemars",
"server",
] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["raw_value"] }
thiserror = { workspace = true }
tracing = { workspace = true }
urlencoding = { workspace = true }
[dev-dependencies]
codex-utils-cargo-bin = { workspace = true }
divan = { workspace = true }
pretty_assertions = { workspace = true }
[lib]
doctest = false
[[bench]]
name = "tool_catalog"
harness = false