Skip to content

Commit a4f76bd

Browse files
authored
chore: add TS annotation to generated mcp-types (#2424)
Adds the `TS` annotation from https://crates.io/crates/ts-rs to all types to facilitate codegen. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2424). * __->__ #2424 * #2423
1 parent 712bfa0 commit a4f76bd

File tree

4 files changed

+164
-126
lines changed

4 files changed

+164
-126
lines changed

codex-rs/Cargo.lock

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/mcp-types/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ workspace = true
99
[dependencies]
1010
serde = { version = "1", features = ["derive"] }
1111
serde_json = "1"
12+
ts-rs = { version = "11", features = ["serde-json-impl"] }

codex-rs/mcp-types/generate_mcp_types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
SCHEMA_VERSION = "2025-06-18"
1818
JSONRPC_VERSION = "2.0"
1919

20-
STANDARD_DERIVE = "#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]\n"
20+
STANDARD_DERIVE = "#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, TS)]\n"
2121
STANDARD_HASHABLE_DERIVE = (
22-
"#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Hash, Eq)]\n"
22+
"#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Hash, Eq, TS)]\n"
2323
)
2424

2525
# Will be populated with the schema's `definitions` map in `main()` so that
@@ -75,6 +75,8 @@ def main() -> int:
7575
use serde::de::DeserializeOwned;
7676
use std::convert::TryFrom;
7777
78+
use ts_rs::TS;
79+
7880
pub const MCP_SCHEMA_VERSION: &str = "{SCHEMA_VERSION}";
7981
pub const JSONRPC_VERSION: &str = "{JSONRPC_VERSION}";
8082

0 commit comments

Comments
 (0)