From afe623d5a82c05b4ba38bd9058cdc8ab56d03e57 Mon Sep 17 00:00:00 2001 From: Joshua Coles Date: Fri, 14 Mar 2025 21:14:57 +0000 Subject: [PATCH] Stash --- ext/mcp/Cargo.lock | 1294 ++- ext/mcp/Cargo.toml | 12 + ext/mcp/schema.json | 2076 +++++ ext/mcp/src/internal-test.rs | 152 + ext/mcp/src/lib.rs | 2 + ext/mcp/src/mcp_client.rs | 30 + ext/mcp/src/types.rs | 13982 +++++++++++++++++++++++++++++++++ 7 files changed, 17540 insertions(+), 8 deletions(-) create mode 100644 ext/mcp/schema.json create mode 100644 ext/mcp/src/internal-test.rs create mode 100644 ext/mcp/src/mcp_client.rs create mode 100644 ext/mcp/src/types.rs diff --git a/ext/mcp/Cargo.lock b/ext/mcp/Cargo.lock index 6c79e05..c766a73 100644 --- a/ext/mcp/Cargo.lock +++ b/ext/mcp/Cargo.lock @@ -43,6 +43,12 @@ dependencies = [ "syn", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.4.0" @@ -64,6 +70,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "bindgen" version = "0.69.5" @@ -79,7 +91,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash", + "rustc-hash 1.1.0", "shlex", "syn", ] @@ -90,12 +102,58 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +dependencies = [ + "byteorder", + "iovec", +] + [[package]] name = "bytes" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +[[package]] +name = "cc" +version = "1.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c736e259eea577f443d5c86c304f9f4ae0295c43f3ba05c21f1d66b5f06001af" +dependencies = [ + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cexpr" version = "0.6.0" @@ -122,6 +180,61 @@ dependencies = [ "libloading", ] +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes 1.10.1", + "memchr", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + [[package]] name = "displaydoc" version = "0.2.5" @@ -139,6 +252,18 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -148,6 +273,108 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "futures" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" +dependencies = [ + "gloo-timers", + "send_wrapper", +] + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "gimli" version = "0.31.1" @@ -160,6 +387,174 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "gloo-net" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06f627b1a58ca3d42b45d6104bf1e1a03799df472df00988b6ba21accc10580" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils", + "http", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "gloo-utils" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "h2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" +dependencies = [ + "atomic-waker", + "bytes 1.10.1", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "http" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" +dependencies = [ + "bytes 1.10.1", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes 1.10.1", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes 1.10.1", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2d708df4e7140240a16cd6ab0ab65c972d7433ab77819ea693fde9c43811e2a" + +[[package]] +name = "hyper" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +dependencies = [ + "bytes 1.10.1", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "log", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +dependencies = [ + "bytes 1.10.1", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + [[package]] name = "icu_collections" version = "1.5.0" @@ -299,6 +694,25 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "indexmap" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + [[package]] name = "itertools" version = "0.12.1" @@ -314,6 +728,162 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jni" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "jsonrpsee" +version = "0.24.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "834af00800e962dee8f7bfc0f60601de215e73e78e5497d733a2919da837d3c8" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-http-client", + "jsonrpsee-types", + "jsonrpsee-wasm-client", + "jsonrpsee-ws-client", + "tracing", +] + +[[package]] +name = "jsonrpsee-client-transport" +version = "0.24.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "def0fd41e2f53118bd1620478d12305b2c75feef57ea1f93ef70568c98081b7e" +dependencies = [ + "base64", + "futures-channel", + "futures-util", + "gloo-net", + "http", + "jsonrpsee-core", + "pin-project", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "soketto", + "thiserror", + "tokio", + "tokio-rustls", + "tokio-util", + "tracing", + "url", +] + +[[package]] +name = "jsonrpsee-core" +version = "0.24.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76637f6294b04e747d68e69336ef839a3493ca62b35bf488ead525f7da75c5bb" +dependencies = [ + "async-trait", + "bytes 1.10.1", + "futures-timer", + "futures-util", + "http", + "http-body", + "http-body-util", + "jsonrpsee-types", + "pin-project", + "rustc-hash 2.1.1", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "wasm-bindgen-futures", +] + +[[package]] +name = "jsonrpsee-http-client" +version = "0.24.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87c24e981ad17798bbca852b0738bfb7b94816ed687bd0d5da60bfa35fa0fdc3" +dependencies = [ + "async-trait", + "base64", + "http-body", + "hyper", + "hyper-rustls", + "hyper-util", + "jsonrpsee-core", + "jsonrpsee-types", + "rustls", + "rustls-platform-verifier", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "tracing", + "url", +] + +[[package]] +name = "jsonrpsee-types" +version = "0.24.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddb81adb1a5ae9182df379e374a79e24e992334e7346af4d065ae5b2acb8d4c6" +dependencies = [ + "http", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "jsonrpsee-wasm-client" +version = "0.24.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e41af42ca39657313748174d02766e5287d3a57356f16756dbd8065b933977" +dependencies = [ + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-types", +] + +[[package]] +name = "jsonrpsee-ws-client" +version = "0.24.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f4f3642a292f5b76d8a16af5c88c16a0860f2ccc778104e5c848b28183d9538" +dependencies = [ + "http", + "jsonrpsee-client-transport", + "jsonrpsee-core", + "jsonrpsee-types", + "url", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -358,6 +928,12 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "log" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" + [[package]] name = "magnus" version = "0.7.1" @@ -381,12 +957,29 @@ dependencies = [ "syn", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "mcp" version = "0.1.0" dependencies = [ + "anyhow", + "jsonrpsee", "magnus", "mcp-sdk", + "serde", + "serde_json", + "tokio", + "tokio-stdin-stdout", + "tracing", + "tracing-subscriber", ] [[package]] @@ -433,7 +1026,7 @@ checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -446,6 +1039,44 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + [[package]] name = "object" version = "0.36.7" @@ -461,6 +1092,18 @@ version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking_lot" version = "0.12.3" @@ -490,12 +1133,47 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pin-project" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfe2e71e1471fe07709406bf725f710b02927c9c54b2b5b2ec0e8087d97c327d" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e859e6e5bd50440ab63c47e3ebabc90f26251f7c73c3d3e837b74a1cc3fa67" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + [[package]] name = "proc-macro2" version = "1.0.94" @@ -514,6 +1192,36 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "rb-sys" version = "0.9.111" @@ -561,8 +1269,17 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata", - "regex-syntax", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", ] [[package]] @@ -573,15 +1290,35 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.8.5", ] +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + [[package]] name = "regex-syntax" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "ring" +version = "0.17.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e75ec5e92c4d8aede845126adc388046234541629e76029599ed35a003c7ed24" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -594,18 +1331,159 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustls" +version = "0.23.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" + +[[package]] +name = "rustls-platform-verifier" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afbb878bdfdf63a336a5e63561b1835e7a8c91524f51621db870169eac84b490" +dependencies = [ + "core-foundation", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-roots", + "winapi", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" + [[package]] name = "ryu" version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "num-bigint", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + [[package]] name = "seq-macro" version = "0.3.6" @@ -644,6 +1522,26 @@ dependencies = [ "serde", ] +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shell-words" version = "1.1.0" @@ -665,6 +1563,15 @@ dependencies = [ "libc", ] +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.14.0" @@ -678,7 +1585,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "soketto" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e859df029d160cb88608f5d7df7fb4753fd20fdfb4de5644f3d8b8440841721" +dependencies = [ + "base64", + "bytes 1.10.1", + "futures 0.3.31", + "httparse", + "log", + "rand", + "sha1", ] [[package]] @@ -687,6 +1609,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.100" @@ -709,6 +1637,36 @@ dependencies = [ "syn", ] +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "tinystr" version = "0.7.6" @@ -726,7 +1684,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" dependencies = [ "backtrace", - "bytes", + "bytes 1.10.1", "libc", "mio", "parking_lot", @@ -734,7 +1692,18 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-io" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "log", ] [[package]] @@ -748,12 +1717,85 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-rustls" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stdin-stdout" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc480d205310fa52f8ea65e7f9443568b6b342f326e86431d2aeb176d720c17" +dependencies = [ + "futures 0.1.31", + "tokio-io", +] + +[[package]] +name = "tokio-stream" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" +dependencies = [ + "bytes 1.10.1", + "futures-core", + "futures-io", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + [[package]] name = "tracing" version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -777,14 +1819,62 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", + "valuable", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + [[package]] name = "unicode-ident" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.4" @@ -809,12 +1899,164 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-sys" version = "0.52.0" @@ -824,6 +2066,15 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -924,6 +2175,27 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zerofrom" version = "0.1.6" @@ -945,6 +2217,12 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + [[package]] name = "zerovec" version = "0.10.4" diff --git a/ext/mcp/Cargo.toml b/ext/mcp/Cargo.toml index 7e10b62..31a8f2e 100644 --- a/ext/mcp/Cargo.toml +++ b/ext/mcp/Cargo.toml @@ -3,9 +3,21 @@ name = "mcp" version = "0.1.0" edition = "2021" +[[bin]] +name = "internal-test" +path = "src/internal-test.rs" + [lib] crate-type = ["cdylib"] [dependencies] +jsonrpsee = { version = "0.24.8", features = ["client", "tracing"] } magnus = "0.7" mcp-sdk = "0.0.3" +tokio = { version = "1.44.1", features = ["full"] } +anyhow = "1.0.97" +tracing = "0.1.41" +tokio-stdin-stdout = "0.1.5" +serde = { version = "1.0.219", features = ["derive"] } +serde_json = "1.0.140" +tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } diff --git a/ext/mcp/schema.json b/ext/mcp/schema.json new file mode 100644 index 0000000..b1fa649 --- /dev/null +++ b/ext/mcp/schema.json @@ -0,0 +1,2076 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "Annotated": { + "description": "Base for objects that include optional annotations for the client. The client can use annotations to inform how objects are used or displayed", + "properties": { + "annotations": { + "properties": { + "audience": { + "description": "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`).", + "items": { + "$ref": "#/definitions/Role" + }, + "type": "array" + }, + "priority": { + "description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.", + "maximum": 1, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "BlobResourceContents": { + "properties": { + "blob": { + "description": "A base64-encoded string representing the binary data of the item.", + "format": "byte", + "type": "string" + }, + "mimeType": { + "description": "The MIME type of this resource, if known.", + "type": "string" + }, + "uri": { + "description": "The URI of this resource.", + "format": "uri", + "type": "string" + } + }, + "required": [ + "blob", + "uri" + ], + "type": "object" + }, + "CallToolRequest": { + "description": "Used by the client to invoke a tool provided by the server.", + "properties": { + "method": { + "const": "tools/call", + "type": "string" + }, + "params": { + "properties": { + "arguments": { + "additionalProperties": {}, + "type": "object" + }, + "name": { + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "CallToolResult": { + "description": "The server's response to a tool call.\n\nAny errors that originate from the tool SHOULD be reported inside the result\nobject, with `isError` set to true, _not_ as an MCP protocol-level error\nresponse. Otherwise, the LLM would not be able to see that an error occurred\nand self-correct.\n\nHowever, any errors in _finding_ the tool, an error indicating that the\nserver does not support tool calls, or any other exceptional conditions,\nshould be reported as an MCP error response.", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "content": { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TextContent" + }, + { + "$ref": "#/definitions/ImageContent" + }, + { + "$ref": "#/definitions/EmbeddedResource" + } + ] + }, + "type": "array" + }, + "isError": { + "description": "Whether the tool call ended in an error.\n\nIf not set, this is assumed to be false (the call was successful).", + "type": "boolean" + } + }, + "required": [ + "content" + ], + "type": "object" + }, + "CancelledNotification": { + "description": "This notification can be sent by either side to indicate that it is cancelling a previously-issued request.\n\nThe request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.\n\nThis notification indicates that the result will be unused, so any associated processing SHOULD cease.\n\nA client MUST NOT attempt to cancel its `initialize` request.", + "properties": { + "method": { + "const": "notifications/cancelled", + "type": "string" + }, + "params": { + "properties": { + "reason": { + "description": "An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.", + "type": "string" + }, + "requestId": { + "$ref": "#/definitions/RequestId", + "description": "The ID of the request to cancel.\n\nThis MUST correspond to the ID of a request previously issued in the same direction." + } + }, + "required": [ + "requestId" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "ClientCapabilities": { + "description": "Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.", + "properties": { + "experimental": { + "additionalProperties": { + "additionalProperties": true, + "properties": {}, + "type": "object" + }, + "description": "Experimental, non-standard capabilities that the client supports.", + "type": "object" + }, + "roots": { + "description": "Present if the client supports listing roots.", + "properties": { + "listChanged": { + "description": "Whether the client supports notifications for changes to the roots list.", + "type": "boolean" + } + }, + "type": "object" + }, + "sampling": { + "additionalProperties": true, + "description": "Present if the client supports sampling from an LLM.", + "properties": {}, + "type": "object" + } + }, + "type": "object" + }, + "ClientNotification": { + "anyOf": [ + { + "$ref": "#/definitions/CancelledNotification" + }, + { + "$ref": "#/definitions/InitializedNotification" + }, + { + "$ref": "#/definitions/ProgressNotification" + }, + { + "$ref": "#/definitions/RootsListChangedNotification" + } + ] + }, + "ClientRequest": { + "anyOf": [ + { + "$ref": "#/definitions/InitializeRequest" + }, + { + "$ref": "#/definitions/PingRequest" + }, + { + "$ref": "#/definitions/ListResourcesRequest" + }, + { + "$ref": "#/definitions/ListResourceTemplatesRequest" + }, + { + "$ref": "#/definitions/ReadResourceRequest" + }, + { + "$ref": "#/definitions/SubscribeRequest" + }, + { + "$ref": "#/definitions/UnsubscribeRequest" + }, + { + "$ref": "#/definitions/ListPromptsRequest" + }, + { + "$ref": "#/definitions/GetPromptRequest" + }, + { + "$ref": "#/definitions/ListToolsRequest" + }, + { + "$ref": "#/definitions/CallToolRequest" + }, + { + "$ref": "#/definitions/SetLevelRequest" + }, + { + "$ref": "#/definitions/CompleteRequest" + } + ] + }, + "ClientResult": { + "anyOf": [ + { + "$ref": "#/definitions/Result" + }, + { + "$ref": "#/definitions/CreateMessageResult" + }, + { + "$ref": "#/definitions/ListRootsResult" + } + ] + }, + "CompleteRequest": { + "description": "A request from the client to the server, to ask for completion options.", + "properties": { + "method": { + "const": "completion/complete", + "type": "string" + }, + "params": { + "properties": { + "argument": { + "description": "The argument's information", + "properties": { + "name": { + "description": "The name of the argument", + "type": "string" + }, + "value": { + "description": "The value of the argument to use for completion matching.", + "type": "string" + } + }, + "required": [ + "name", + "value" + ], + "type": "object" + }, + "ref": { + "anyOf": [ + { + "$ref": "#/definitions/PromptReference" + }, + { + "$ref": "#/definitions/ResourceReference" + } + ] + } + }, + "required": [ + "argument", + "ref" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "CompleteResult": { + "description": "The server's response to a completion/complete request", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "completion": { + "properties": { + "hasMore": { + "description": "Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.", + "type": "boolean" + }, + "total": { + "description": "The total number of completion options available. This can exceed the number of values actually sent in the response.", + "type": "integer" + }, + "values": { + "description": "An array of completion values. Must not exceed 100 items.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "required": [ + "values" + ], + "type": "object" + } + }, + "required": [ + "completion" + ], + "type": "object" + }, + "CreateMessageRequest": { + "description": "A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.", + "properties": { + "method": { + "const": "sampling/createMessage", + "type": "string" + }, + "params": { + "properties": { + "includeContext": { + "description": "A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.", + "enum": [ + "allServers", + "none", + "thisServer" + ], + "type": "string" + }, + "maxTokens": { + "description": "The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.", + "type": "integer" + }, + "messages": { + "items": { + "$ref": "#/definitions/SamplingMessage" + }, + "type": "array" + }, + "metadata": { + "additionalProperties": true, + "description": "Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.", + "properties": {}, + "type": "object" + }, + "modelPreferences": { + "$ref": "#/definitions/ModelPreferences", + "description": "The server's preferences for which model to select. The client MAY ignore these preferences." + }, + "stopSequences": { + "items": { + "type": "string" + }, + "type": "array" + }, + "systemPrompt": { + "description": "An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.", + "type": "string" + }, + "temperature": { + "type": "number" + } + }, + "required": [ + "maxTokens", + "messages" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "CreateMessageResult": { + "description": "The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "content": { + "anyOf": [ + { + "$ref": "#/definitions/TextContent" + }, + { + "$ref": "#/definitions/ImageContent" + } + ] + }, + "model": { + "description": "The name of the model that generated the message.", + "type": "string" + }, + "role": { + "$ref": "#/definitions/Role" + }, + "stopReason": { + "description": "The reason why sampling stopped, if known.", + "type": "string" + } + }, + "required": [ + "content", + "model", + "role" + ], + "type": "object" + }, + "Cursor": { + "description": "An opaque token used to represent a cursor for pagination.", + "type": "string" + }, + "EmbeddedResource": { + "description": "The contents of a resource, embedded into a prompt or tool call result.\n\nIt is up to the client how best to render embedded resources for the benefit\nof the LLM and/or the user.", + "properties": { + "annotations": { + "properties": { + "audience": { + "description": "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`).", + "items": { + "$ref": "#/definitions/Role" + }, + "type": "array" + }, + "priority": { + "description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.", + "maximum": 1, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "resource": { + "anyOf": [ + { + "$ref": "#/definitions/TextResourceContents" + }, + { + "$ref": "#/definitions/BlobResourceContents" + } + ] + }, + "type": { + "const": "resource", + "type": "string" + } + }, + "required": [ + "resource", + "type" + ], + "type": "object" + }, + "EmptyResult": { + "$ref": "#/definitions/Result" + }, + "GetPromptRequest": { + "description": "Used by the client to get a prompt provided by the server.", + "properties": { + "method": { + "const": "prompts/get", + "type": "string" + }, + "params": { + "properties": { + "arguments": { + "additionalProperties": { + "type": "string" + }, + "description": "Arguments to use for templating the prompt.", + "type": "object" + }, + "name": { + "description": "The name of the prompt or prompt template.", + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "GetPromptResult": { + "description": "The server's response to a prompts/get request from the client.", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "description": { + "description": "An optional description for the prompt.", + "type": "string" + }, + "messages": { + "items": { + "$ref": "#/definitions/PromptMessage" + }, + "type": "array" + } + }, + "required": [ + "messages" + ], + "type": "object" + }, + "ImageContent": { + "description": "An image provided to or from an LLM.", + "properties": { + "annotations": { + "properties": { + "audience": { + "description": "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`).", + "items": { + "$ref": "#/definitions/Role" + }, + "type": "array" + }, + "priority": { + "description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.", + "maximum": 1, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "data": { + "description": "The base64-encoded image data.", + "format": "byte", + "type": "string" + }, + "mimeType": { + "description": "The MIME type of the image. Different providers may support different image types.", + "type": "string" + }, + "type": { + "const": "image", + "type": "string" + } + }, + "required": [ + "data", + "mimeType", + "type" + ], + "type": "object" + }, + "Implementation": { + "description": "Describes the name and version of an MCP implementation.", + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + } + }, + "required": [ + "name", + "version" + ], + "type": "object" + }, + "InitializeRequest": { + "description": "This request is sent from the client to the server when it first connects, asking it to begin initialization.", + "properties": { + "method": { + "const": "initialize", + "type": "string" + }, + "params": { + "properties": { + "capabilities": { + "$ref": "#/definitions/ClientCapabilities" + }, + "clientInfo": { + "$ref": "#/definitions/Implementation" + }, + "protocolVersion": { + "description": "The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.", + "type": "string" + } + }, + "required": [ + "capabilities", + "clientInfo", + "protocolVersion" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "InitializeResult": { + "description": "After receiving an initialize request from the client, the server sends this response.", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "capabilities": { + "$ref": "#/definitions/ServerCapabilities" + }, + "instructions": { + "description": "Instructions describing how to use the server and its features.\n\nThis can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a \"hint\" to the model. For example, this information MAY be added to the system prompt.", + "type": "string" + }, + "protocolVersion": { + "description": "The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.", + "type": "string" + }, + "serverInfo": { + "$ref": "#/definitions/Implementation" + } + }, + "required": [ + "capabilities", + "protocolVersion", + "serverInfo" + ], + "type": "object" + }, + "InitializedNotification": { + "description": "This notification is sent from the client to the server after initialization has finished.", + "properties": { + "method": { + "const": "notifications/initialized", + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.", + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "JSONRPCError": { + "description": "A response to a request that indicates an error occurred.", + "properties": { + "error": { + "properties": { + "code": { + "description": "The error type that occurred.", + "type": "integer" + }, + "data": { + "description": "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)." + }, + "message": { + "description": "A short description of the error. The message SHOULD be limited to a concise single sentence.", + "type": "string" + } + }, + "required": [ + "code", + "message" + ], + "type": "object" + }, + "id": { + "$ref": "#/definitions/RequestId" + }, + "jsonrpc": { + "const": "2.0", + "type": "string" + } + }, + "required": [ + "error", + "id", + "jsonrpc" + ], + "type": "object" + }, + "JSONRPCMessage": { + "anyOf": [ + { + "$ref": "#/definitions/JSONRPCRequest" + }, + { + "$ref": "#/definitions/JSONRPCNotification" + }, + { + "$ref": "#/definitions/JSONRPCResponse" + }, + { + "$ref": "#/definitions/JSONRPCError" + } + ] + }, + "JSONRPCNotification": { + "description": "A notification which does not expect a response.", + "properties": { + "jsonrpc": { + "const": "2.0", + "type": "string" + }, + "method": { + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.", + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "jsonrpc", + "method" + ], + "type": "object" + }, + "JSONRPCRequest": { + "description": "A request that expects a response.", + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "jsonrpc": { + "const": "2.0", + "type": "string" + }, + "method": { + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "properties": { + "progressToken": { + "$ref": "#/definitions/ProgressToken", + "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications." + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "id", + "jsonrpc", + "method" + ], + "type": "object" + }, + "JSONRPCResponse": { + "description": "A successful (non-error) response to a request.", + "properties": { + "id": { + "$ref": "#/definitions/RequestId" + }, + "jsonrpc": { + "const": "2.0", + "type": "string" + }, + "result": { + "$ref": "#/definitions/Result" + } + }, + "required": [ + "id", + "jsonrpc", + "result" + ], + "type": "object" + }, + "ListPromptsRequest": { + "description": "Sent from the client to request a list of prompts and prompt templates the server has.", + "properties": { + "method": { + "const": "prompts/list", + "type": "string" + }, + "params": { + "properties": { + "cursor": { + "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.", + "type": "string" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "ListPromptsResult": { + "description": "The server's response to a prompts/list request from the client.", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "nextCursor": { + "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.", + "type": "string" + }, + "prompts": { + "items": { + "$ref": "#/definitions/Prompt" + }, + "type": "array" + } + }, + "required": [ + "prompts" + ], + "type": "object" + }, + "ListResourceTemplatesRequest": { + "description": "Sent from the client to request a list of resource templates the server has.", + "properties": { + "method": { + "const": "resources/templates/list", + "type": "string" + }, + "params": { + "properties": { + "cursor": { + "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.", + "type": "string" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "ListResourceTemplatesResult": { + "description": "The server's response to a resources/templates/list request from the client.", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "nextCursor": { + "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.", + "type": "string" + }, + "resourceTemplates": { + "items": { + "$ref": "#/definitions/ResourceTemplate" + }, + "type": "array" + } + }, + "required": [ + "resourceTemplates" + ], + "type": "object" + }, + "ListResourcesRequest": { + "description": "Sent from the client to request a list of resources the server has.", + "properties": { + "method": { + "const": "resources/list", + "type": "string" + }, + "params": { + "properties": { + "cursor": { + "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.", + "type": "string" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "ListResourcesResult": { + "description": "The server's response to a resources/list request from the client.", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "nextCursor": { + "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.", + "type": "string" + }, + "resources": { + "items": { + "$ref": "#/definitions/Resource" + }, + "type": "array" + } + }, + "required": [ + "resources" + ], + "type": "object" + }, + "ListRootsRequest": { + "description": "Sent from the server to request a list of root URIs from the client. Roots allow\nservers to ask for specific directories or files to operate on. A common example\nfor roots is providing a set of repositories or directories a server should operate\non.\n\nThis request is typically used when the server needs to understand the file system\nstructure or access specific locations that the client has permission to read from.", + "properties": { + "method": { + "const": "roots/list", + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "properties": { + "progressToken": { + "$ref": "#/definitions/ProgressToken", + "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications." + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "ListRootsResult": { + "description": "The client's response to a roots/list request from the server.\nThis result contains an array of Root objects, each representing a root directory\nor file that the server can operate on.", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "roots": { + "items": { + "$ref": "#/definitions/Root" + }, + "type": "array" + } + }, + "required": [ + "roots" + ], + "type": "object" + }, + "ListToolsRequest": { + "description": "Sent from the client to request a list of tools the server has.", + "properties": { + "method": { + "const": "tools/list", + "type": "string" + }, + "params": { + "properties": { + "cursor": { + "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.", + "type": "string" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "ListToolsResult": { + "description": "The server's response to a tools/list request from the client.", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "nextCursor": { + "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.", + "type": "string" + }, + "tools": { + "items": { + "$ref": "#/definitions/Tool" + }, + "type": "array" + } + }, + "required": [ + "tools" + ], + "type": "object" + }, + "LoggingLevel": { + "description": "The severity of a log message.\n\nThese map to syslog message severities, as specified in RFC-5424:\nhttps://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1", + "enum": [ + "alert", + "critical", + "debug", + "emergency", + "error", + "info", + "notice", + "warning" + ], + "type": "string" + }, + "LoggingMessageNotification": { + "description": "Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.", + "properties": { + "method": { + "const": "notifications/message", + "type": "string" + }, + "params": { + "properties": { + "data": { + "description": "The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here." + }, + "level": { + "$ref": "#/definitions/LoggingLevel", + "description": "The severity of this log message." + }, + "logger": { + "description": "An optional name of the logger issuing this message.", + "type": "string" + } + }, + "required": [ + "data", + "level" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "ModelHint": { + "description": "Hints to use for model selection.\n\nKeys not declared here are currently left unspecified by the spec and are up\nto the client to interpret.", + "properties": { + "name": { + "description": "A hint for a model name.\n\nThe client SHOULD treat this as a substring of a model name; for example:\n - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`\n - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.\n - `claude` should match any Claude model\n\nThe client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:\n - `gemini-1.5-flash` could match `claude-3-haiku-20240307`", + "type": "string" + } + }, + "type": "object" + }, + "ModelPreferences": { + "description": "The server's preferences for model selection, requested of the client during sampling.\n\nBecause LLMs can vary along multiple dimensions, choosing the \"best\" model is\nrarely straightforward. Different models excel in different areas—some are\nfaster but less capable, others are more capable but more expensive, and so\non. This interface allows servers to express their priorities across multiple\ndimensions to help clients make an appropriate selection for their use case.\n\nThese preferences are always advisory. The client MAY ignore them. It is also\nup to the client to decide how to interpret these preferences and how to\nbalance them against other considerations.", + "properties": { + "costPriority": { + "description": "How much to prioritize cost when selecting a model. A value of 0 means cost\nis not important, while a value of 1 means cost is the most important\nfactor.", + "maximum": 1, + "minimum": 0, + "type": "number" + }, + "hints": { + "description": "Optional hints to use for model selection.\n\nIf multiple hints are specified, the client MUST evaluate them in order\n(such that the first match is taken).\n\nThe client SHOULD prioritize these hints over the numeric priorities, but\nMAY still use the priorities to select from ambiguous matches.", + "items": { + "$ref": "#/definitions/ModelHint" + }, + "type": "array" + }, + "intelligencePriority": { + "description": "How much to prioritize intelligence and capabilities when selecting a\nmodel. A value of 0 means intelligence is not important, while a value of 1\nmeans intelligence is the most important factor.", + "maximum": 1, + "minimum": 0, + "type": "number" + }, + "speedPriority": { + "description": "How much to prioritize sampling speed (latency) when selecting a model. A\nvalue of 0 means speed is not important, while a value of 1 means speed is\nthe most important factor.", + "maximum": 1, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "Notification": { + "properties": { + "method": { + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.", + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "PaginatedRequest": { + "properties": { + "method": { + "type": "string" + }, + "params": { + "properties": { + "cursor": { + "description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.", + "type": "string" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "PaginatedResult": { + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "nextCursor": { + "description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.", + "type": "string" + } + }, + "type": "object" + }, + "PingRequest": { + "description": "A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.", + "properties": { + "method": { + "const": "ping", + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "properties": { + "progressToken": { + "$ref": "#/definitions/ProgressToken", + "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications." + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "ProgressNotification": { + "description": "An out-of-band notification used to inform the receiver of a progress update for a long-running request.", + "properties": { + "method": { + "const": "notifications/progress", + "type": "string" + }, + "params": { + "properties": { + "progress": { + "description": "The progress thus far. This should increase every time progress is made, even if the total is unknown.", + "type": "number" + }, + "progressToken": { + "$ref": "#/definitions/ProgressToken", + "description": "The progress token which was given in the initial request, used to associate this notification with the request that is proceeding." + }, + "total": { + "description": "Total number of items to process (or total progress required), if known.", + "type": "number" + } + }, + "required": [ + "progress", + "progressToken" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "ProgressToken": { + "description": "A progress token, used to associate progress notifications with the original request.", + "type": [ + "string", + "integer" + ] + }, + "Prompt": { + "description": "A prompt or prompt template that the server offers.", + "properties": { + "arguments": { + "description": "A list of arguments to use for templating the prompt.", + "items": { + "$ref": "#/definitions/PromptArgument" + }, + "type": "array" + }, + "description": { + "description": "An optional description of what this prompt provides", + "type": "string" + }, + "name": { + "description": "The name of the prompt or prompt template.", + "type": "string" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "PromptArgument": { + "description": "Describes an argument that a prompt can accept.", + "properties": { + "description": { + "description": "A human-readable description of the argument.", + "type": "string" + }, + "name": { + "description": "The name of the argument.", + "type": "string" + }, + "required": { + "description": "Whether this argument must be provided.", + "type": "boolean" + } + }, + "required": [ + "name" + ], + "type": "object" + }, + "PromptListChangedNotification": { + "description": "An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.", + "properties": { + "method": { + "const": "notifications/prompts/list_changed", + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.", + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "PromptMessage": { + "description": "Describes a message returned as part of a prompt.\n\nThis is similar to `SamplingMessage`, but also supports the embedding of\nresources from the MCP server.", + "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/TextContent" + }, + { + "$ref": "#/definitions/ImageContent" + }, + { + "$ref": "#/definitions/EmbeddedResource" + } + ] + }, + "role": { + "$ref": "#/definitions/Role" + } + }, + "required": [ + "content", + "role" + ], + "type": "object" + }, + "PromptReference": { + "description": "Identifies a prompt.", + "properties": { + "name": { + "description": "The name of the prompt or prompt template", + "type": "string" + }, + "type": { + "const": "ref/prompt", + "type": "string" + } + }, + "required": [ + "name", + "type" + ], + "type": "object" + }, + "ReadResourceRequest": { + "description": "Sent from the client to the server, to read a specific resource URI.", + "properties": { + "method": { + "const": "resources/read", + "type": "string" + }, + "params": { + "properties": { + "uri": { + "description": "The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.", + "format": "uri", + "type": "string" + } + }, + "required": [ + "uri" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "ReadResourceResult": { + "description": "The server's response to a resources/read request from the client.", + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + }, + "contents": { + "items": { + "anyOf": [ + { + "$ref": "#/definitions/TextResourceContents" + }, + { + "$ref": "#/definitions/BlobResourceContents" + } + ] + }, + "type": "array" + } + }, + "required": [ + "contents" + ], + "type": "object" + }, + "Request": { + "properties": { + "method": { + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "properties": { + "progressToken": { + "$ref": "#/definitions/ProgressToken", + "description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications." + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "RequestId": { + "description": "A uniquely identifying ID for a request in JSON-RPC.", + "type": [ + "string", + "integer" + ] + }, + "Resource": { + "description": "A known resource that the server is capable of reading.", + "properties": { + "annotations": { + "properties": { + "audience": { + "description": "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`).", + "items": { + "$ref": "#/definitions/Role" + }, + "type": "array" + }, + "priority": { + "description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.", + "maximum": 1, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "description": { + "description": "A description of what this resource represents.\n\nThis can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.", + "type": "string" + }, + "mimeType": { + "description": "The MIME type of this resource, if known.", + "type": "string" + }, + "name": { + "description": "A human-readable name for this resource.\n\nThis can be used by clients to populate UI elements.", + "type": "string" + }, + "size": { + "description": "The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\n\nThis can be used by Hosts to display file sizes and estimate context window usage.", + "type": "integer" + }, + "uri": { + "description": "The URI of this resource.", + "format": "uri", + "type": "string" + } + }, + "required": [ + "name", + "uri" + ], + "type": "object" + }, + "ResourceContents": { + "description": "The contents of a specific resource or sub-resource.", + "properties": { + "mimeType": { + "description": "The MIME type of this resource, if known.", + "type": "string" + }, + "uri": { + "description": "The URI of this resource.", + "format": "uri", + "type": "string" + } + }, + "required": [ + "uri" + ], + "type": "object" + }, + "ResourceListChangedNotification": { + "description": "An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.", + "properties": { + "method": { + "const": "notifications/resources/list_changed", + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.", + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "ResourceReference": { + "description": "A reference to a resource or resource template definition.", + "properties": { + "type": { + "const": "ref/resource", + "type": "string" + }, + "uri": { + "description": "The URI or URI template of the resource.", + "format": "uri-template", + "type": "string" + } + }, + "required": [ + "type", + "uri" + ], + "type": "object" + }, + "ResourceTemplate": { + "description": "A template description for resources available on the server.", + "properties": { + "annotations": { + "properties": { + "audience": { + "description": "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`).", + "items": { + "$ref": "#/definitions/Role" + }, + "type": "array" + }, + "priority": { + "description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.", + "maximum": 1, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "description": { + "description": "A description of what this template is for.\n\nThis can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model.", + "type": "string" + }, + "mimeType": { + "description": "The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.", + "type": "string" + }, + "name": { + "description": "A human-readable name for the type of resource this template refers to.\n\nThis can be used by clients to populate UI elements.", + "type": "string" + }, + "uriTemplate": { + "description": "A URI template (according to RFC 6570) that can be used to construct resource URIs.", + "format": "uri-template", + "type": "string" + } + }, + "required": [ + "name", + "uriTemplate" + ], + "type": "object" + }, + "ResourceUpdatedNotification": { + "description": "A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.", + "properties": { + "method": { + "const": "notifications/resources/updated", + "type": "string" + }, + "params": { + "properties": { + "uri": { + "description": "The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.", + "format": "uri", + "type": "string" + } + }, + "required": [ + "uri" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "Result": { + "additionalProperties": {}, + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.", + "type": "object" + } + }, + "type": "object" + }, + "Role": { + "description": "The sender or recipient of messages and data in a conversation.", + "enum": [ + "assistant", + "user" + ], + "type": "string" + }, + "Root": { + "description": "Represents a root directory or file that the server can operate on.", + "properties": { + "name": { + "description": "An optional name for the root. This can be used to provide a human-readable\nidentifier for the root, which may be useful for display purposes or for\nreferencing the root in other parts of the application.", + "type": "string" + }, + "uri": { + "description": "The URI identifying the root. This *must* start with file:// for now.\nThis restriction may be relaxed in future versions of the protocol to allow\nother URI schemes.", + "format": "uri", + "type": "string" + } + }, + "required": [ + "uri" + ], + "type": "object" + }, + "RootsListChangedNotification": { + "description": "A notification from the client to the server, informing it that the list of roots has changed.\nThis notification should be sent whenever the client adds, removes, or modifies any root.\nThe server should then request an updated list of roots using the ListRootsRequest.", + "properties": { + "method": { + "const": "notifications/roots/list_changed", + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.", + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "SamplingMessage": { + "description": "Describes a message issued to or received from an LLM API.", + "properties": { + "content": { + "anyOf": [ + { + "$ref": "#/definitions/TextContent" + }, + { + "$ref": "#/definitions/ImageContent" + } + ] + }, + "role": { + "$ref": "#/definitions/Role" + } + }, + "required": [ + "content", + "role" + ], + "type": "object" + }, + "ServerCapabilities": { + "description": "Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.", + "properties": { + "experimental": { + "additionalProperties": { + "additionalProperties": true, + "properties": {}, + "type": "object" + }, + "description": "Experimental, non-standard capabilities that the server supports.", + "type": "object" + }, + "logging": { + "additionalProperties": true, + "description": "Present if the server supports sending log messages to the client.", + "properties": {}, + "type": "object" + }, + "prompts": { + "description": "Present if the server offers any prompt templates.", + "properties": { + "listChanged": { + "description": "Whether this server supports notifications for changes to the prompt list.", + "type": "boolean" + } + }, + "type": "object" + }, + "resources": { + "description": "Present if the server offers any resources to read.", + "properties": { + "listChanged": { + "description": "Whether this server supports notifications for changes to the resource list.", + "type": "boolean" + }, + "subscribe": { + "description": "Whether this server supports subscribing to resource updates.", + "type": "boolean" + } + }, + "type": "object" + }, + "tools": { + "description": "Present if the server offers any tools to call.", + "properties": { + "listChanged": { + "description": "Whether this server supports notifications for changes to the tool list.", + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "ServerNotification": { + "anyOf": [ + { + "$ref": "#/definitions/CancelledNotification" + }, + { + "$ref": "#/definitions/ProgressNotification" + }, + { + "$ref": "#/definitions/ResourceListChangedNotification" + }, + { + "$ref": "#/definitions/ResourceUpdatedNotification" + }, + { + "$ref": "#/definitions/PromptListChangedNotification" + }, + { + "$ref": "#/definitions/ToolListChangedNotification" + }, + { + "$ref": "#/definitions/LoggingMessageNotification" + } + ] + }, + "ServerRequest": { + "anyOf": [ + { + "$ref": "#/definitions/PingRequest" + }, + { + "$ref": "#/definitions/CreateMessageRequest" + }, + { + "$ref": "#/definitions/ListRootsRequest" + } + ] + }, + "ServerResult": { + "anyOf": [ + { + "$ref": "#/definitions/Result" + }, + { + "$ref": "#/definitions/InitializeResult" + }, + { + "$ref": "#/definitions/ListResourcesResult" + }, + { + "$ref": "#/definitions/ListResourceTemplatesResult" + }, + { + "$ref": "#/definitions/ReadResourceResult" + }, + { + "$ref": "#/definitions/ListPromptsResult" + }, + { + "$ref": "#/definitions/GetPromptResult" + }, + { + "$ref": "#/definitions/ListToolsResult" + }, + { + "$ref": "#/definitions/CallToolResult" + }, + { + "$ref": "#/definitions/CompleteResult" + } + ] + }, + "SetLevelRequest": { + "description": "A request from the client to the server, to enable or adjust logging.", + "properties": { + "method": { + "const": "logging/setLevel", + "type": "string" + }, + "params": { + "properties": { + "level": { + "$ref": "#/definitions/LoggingLevel", + "description": "The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message." + } + }, + "required": [ + "level" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "SubscribeRequest": { + "description": "Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.", + "properties": { + "method": { + "const": "resources/subscribe", + "type": "string" + }, + "params": { + "properties": { + "uri": { + "description": "The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.", + "format": "uri", + "type": "string" + } + }, + "required": [ + "uri" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + }, + "TextContent": { + "description": "Text provided to or from an LLM.", + "properties": { + "annotations": { + "properties": { + "audience": { + "description": "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`).", + "items": { + "$ref": "#/definitions/Role" + }, + "type": "array" + }, + "priority": { + "description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.", + "maximum": 1, + "minimum": 0, + "type": "number" + } + }, + "type": "object" + }, + "text": { + "description": "The text content of the message.", + "type": "string" + }, + "type": { + "const": "text", + "type": "string" + } + }, + "required": [ + "text", + "type" + ], + "type": "object" + }, + "TextResourceContents": { + "properties": { + "mimeType": { + "description": "The MIME type of this resource, if known.", + "type": "string" + }, + "text": { + "description": "The text of the item. This must only be set if the item can actually be represented as text (not binary data).", + "type": "string" + }, + "uri": { + "description": "The URI of this resource.", + "format": "uri", + "type": "string" + } + }, + "required": [ + "text", + "uri" + ], + "type": "object" + }, + "Tool": { + "description": "Definition for a tool the client can call.", + "properties": { + "description": { + "description": "A human-readable description of the tool.", + "type": "string" + }, + "inputSchema": { + "description": "A JSON Schema object defining the expected parameters for the tool.", + "properties": { + "properties": { + "additionalProperties": { + "additionalProperties": true, + "properties": {}, + "type": "object" + }, + "type": "object" + }, + "required": { + "items": { + "type": "string" + }, + "type": "array" + }, + "type": { + "const": "object", + "type": "string" + } + }, + "required": [ + "type" + ], + "type": "object" + }, + "name": { + "description": "The name of the tool.", + "type": "string" + } + }, + "required": [ + "inputSchema", + "name" + ], + "type": "object" + }, + "ToolListChangedNotification": { + "description": "An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.", + "properties": { + "method": { + "const": "notifications/tools/list_changed", + "type": "string" + }, + "params": { + "additionalProperties": {}, + "properties": { + "_meta": { + "additionalProperties": {}, + "description": "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.", + "type": "object" + } + }, + "type": "object" + } + }, + "required": [ + "method" + ], + "type": "object" + }, + "UnsubscribeRequest": { + "description": "Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.", + "properties": { + "method": { + "const": "resources/unsubscribe", + "type": "string" + }, + "params": { + "properties": { + "uri": { + "description": "The URI of the resource to unsubscribe from.", + "format": "uri", + "type": "string" + } + }, + "required": [ + "uri" + ], + "type": "object" + } + }, + "required": [ + "method", + "params" + ], + "type": "object" + } + } +} diff --git a/ext/mcp/src/internal-test.rs b/ext/mcp/src/internal-test.rs new file mode 100644 index 0000000..5130b92 --- /dev/null +++ b/ext/mcp/src/internal-test.rs @@ -0,0 +1,152 @@ +use std::collections::HashMap; +use std::process::Stdio; +use std::sync::Arc; +use jsonrpsee::core::async_trait; +use jsonrpsee::core::client::{ + Client, ClientBuilder, ClientT, ReceivedMessage, TransportReceiverT, TransportSenderT, +}; +use jsonrpsee::core::traits::ToRpcParams; +use jsonrpsee::rpc_params; +use tokio::process::{Child, ChildStdin, ChildStdout}; +use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader, Stdin, Stdout}; +use serde::{Deserialize, Serialize}; +use serde_json::Error; +use serde_json::value::RawValue; +mod types; + +#[derive(Debug, Clone)] +struct StdioTransport { + stdin: Arc>, + stdout: Arc>>, +} + +impl StdioTransport { + fn new(mut child: Child) -> Self { + let stdin = Arc::new(tokio::sync::Mutex::new(child.stdin.take().unwrap())); + let stdout = Arc::new(tokio::sync::Mutex::new(BufReader::new(child.stdout.take().unwrap()))); + Self { stdin, stdout } + } +} + +#[async_trait] +impl TransportSenderT for StdioTransport { + type Error = tokio::io::Error; + + #[tracing::instrument(skip(self), level = "trace")] + async fn send(&mut self, msg: String) -> Result<(), Self::Error> { + tracing::debug!("Sending message: {}", msg); + let mut stdin = self.stdin.lock().await; + tracing::debug!("Locked stdin"); + stdin.write_all(msg.as_bytes()).await?; + stdin.write_all(b"\n").await?; + tracing::debug!("Wrote to stdin"); + Ok(()) + } +} + +#[async_trait] +impl TransportReceiverT for StdioTransport { + type Error = tokio::io::Error; + + #[tracing::instrument(skip(self), level = "trace")] + async fn receive(&mut self) -> Result { + tracing::debug!("Receiving message"); + let mut stdout = self.stdout.lock().await; + tracing::debug!("Locked stdout"); + let mut str = String::new(); + tracing::debug!("Reading from stdout"); + stdout.read_line(&mut str).await?; + tracing::debug!("Read from stdout: {:?}", str); + Ok(ReceivedMessage::Text(str)) + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct InitializeRequest { + protocol_version: String, + capabilities: Capabilities, + client_info: ClientInfo, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct Capabilities { + roots: Roots, + sampling: HashMap, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct Sampling { + sampling_interval: u64, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct Roots { + list_changed: bool, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +struct ClientInfo { + name: String, + version: String, +} + +impl ToRpcParams for InitializeRequest { + fn to_rpc_params(self) -> Result>, serde_json::Error> { + let s = String::from_utf8(serde_json::to_vec(&self)?).expect("Valid UTF8 format"); + RawValue::from_string(s).map(Some) + } +} + + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .with_file(true) + .with_line_number(true) + .with_thread_ids(true) + .with_thread_names(true) + .with_target(true) + .with_level(true) + .init(); + + tracing::debug!("Hello"); + + types::InitializeRequest { + method: "".to_string(), + params: types::InitializeRequestParams { + capabilities: Default::default(), + client_info: types::Implementation { name: "".to_string(), version: "".to_string() }, + protocol_version: "".to_string(), + }, + } + + let cmd = tokio::process::Command::new("/Users/joshuacoles/.local/bin/mcp-server-fetch") + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .spawn()?; + + let transport = StdioTransport::new(cmd); + + let client: Client = ClientBuilder::default().build_with_tokio( + transport.clone(), + transport.clone(), + ); + + let response: serde_json::Value = client.request("initialize", InitializeRequest { + protocol_version: "2024-11-05".to_string(), + capabilities: Capabilities { + roots: Roots { list_changed: true }, + sampling: HashMap::default(), + }, + client_info: ClientInfo { name: "ExampleClient".to_string(), version: "1.0.0".to_string() }, + }).await?; + + println!("response: {:?}", response); + + Ok(()) +} diff --git a/ext/mcp/src/lib.rs b/ext/mcp/src/lib.rs index 3be93c3..7b13f88 100644 --- a/ext/mcp/src/lib.rs +++ b/ext/mcp/src/lib.rs @@ -1,3 +1,5 @@ +mod mcp_client; + use magnus::{function, Error, Ruby}; fn distance(a: (f64, f64), b: (f64, f64)) -> f64 { diff --git a/ext/mcp/src/mcp_client.rs b/ext/mcp/src/mcp_client.rs new file mode 100644 index 0000000..6eb690f --- /dev/null +++ b/ext/mcp/src/mcp_client.rs @@ -0,0 +1,30 @@ +use std::time::Duration; +use mcp_sdk::client::ClientBuilder; +use mcp_sdk::protocol::RequestOptions; +use mcp_sdk::transport::Transport; + +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn test_a() { + let transport = mcp_sdk::transport::ClientStdioTransport::new( + "/Users/joshuacoles/.local/bin/mcp-server-fetch", + &[], + ).unwrap(); + + transport.open().unwrap(); + + let client = ClientBuilder::new(transport).build(); + let client_clone = client.clone(); + + let a = tokio::spawn(async move { client_clone.start().await }); + let response = client + .request( + "echo", + None, + RequestOptions::default().timeout(Duration::from_secs(1)), + ) + .await.unwrap(); + + println!("{:?}", response); + + a.abort(); +} diff --git a/ext/mcp/src/types.rs b/ext/mcp/src/types.rs new file mode 100644 index 0000000..a11ffaf --- /dev/null +++ b/ext/mcp/src/types.rs @@ -0,0 +1,13982 @@ +#![allow(clippy::redundant_closure_call)] +#![allow(clippy::needless_lifetimes)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::clone_on_copy)] + +#[doc = r" Error types."] +pub mod error { + #[doc = r" Error from a TryFrom or FromStr implementation."] + pub struct ConversionError(::std::borrow::Cow<'static, str>); + impl ::std::error::Error for ConversionError {} + impl ::std::fmt::Display for ConversionError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> { + ::std::fmt::Display::fmt(&self.0, f) + } + } + impl ::std::fmt::Debug for ConversionError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> { + ::std::fmt::Debug::fmt(&self.0, f) + } + } + impl From<&'static str> for ConversionError { + fn from(value: &'static str) -> Self { + Self(value.into()) + } + } + impl From for ConversionError { + fn from(value: String) -> Self { + Self(value.into()) + } + } +} +#[doc = "Base for objects that include optional annotations for the client. The client can use annotations to inform how objects are used or displayed"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Base for objects that include optional annotations for the client. The client can use annotations to inform how objects are used or displayed\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"annotations\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct Annotated { + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub annotations: ::std::option::Option, +} +impl ::std::convert::From<&Annotated> for Annotated { + fn from(value: &Annotated) -> Self { + value.clone() + } +} +impl ::std::default::Default for Annotated { + fn default() -> Self { + Self { + annotations: Default::default(), + } + } +} +impl Annotated { + pub fn builder() -> builder::Annotated { + Default::default() + } +} +#[doc = "AnnotatedAnnotations"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct AnnotatedAnnotations { + #[doc = "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`)."] + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] + pub audience: ::std::vec::Vec, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub priority: ::std::option::Option, +} +impl ::std::convert::From<&AnnotatedAnnotations> for AnnotatedAnnotations { + fn from(value: &AnnotatedAnnotations) -> Self { + value.clone() + } +} +impl ::std::default::Default for AnnotatedAnnotations { + fn default() -> Self { + Self { + audience: Default::default(), + priority: Default::default(), + } + } +} +impl AnnotatedAnnotations { + pub fn builder() -> builder::AnnotatedAnnotations { + Default::default() + } +} +#[doc = "BlobResourceContents"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"blob\","] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"blob\": {"] +#[doc = " \"description\": \"A base64-encoded string representing the binary data of the item.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"byte\""] +#[doc = " },"] +#[doc = " \"mimeType\": {"] +#[doc = " \"description\": \"The MIME type of this resource, if known.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of this resource.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct BlobResourceContents { + #[doc = "A base64-encoded string representing the binary data of the item."] + pub blob: ::std::string::String, + #[doc = "The MIME type of this resource, if known."] + #[serde( + rename = "mimeType", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub mime_type: ::std::option::Option<::std::string::String>, + #[doc = "The URI of this resource."] + pub uri: ::std::string::String, +} +impl ::std::convert::From<&BlobResourceContents> for BlobResourceContents { + fn from(value: &BlobResourceContents) -> Self { + value.clone() + } +} +impl BlobResourceContents { + pub fn builder() -> builder::BlobResourceContents { + Default::default() + } +} +#[doc = "Used by the client to invoke a tool provided by the server."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Used by the client to invoke a tool provided by the server.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"tools/call\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"arguments\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"name\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CallToolRequest { + pub method: ::std::string::String, + pub params: CallToolRequestParams, +} +impl ::std::convert::From<&CallToolRequest> for CallToolRequest { + fn from(value: &CallToolRequest) -> Self { + value.clone() + } +} +impl CallToolRequest { + pub fn builder() -> builder::CallToolRequest { + Default::default() + } +} +#[doc = "CallToolRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"arguments\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"name\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CallToolRequestParams { + #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] + pub arguments: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + pub name: ::std::string::String, +} +impl ::std::convert::From<&CallToolRequestParams> for CallToolRequestParams { + fn from(value: &CallToolRequestParams) -> Self { + value.clone() + } +} +impl CallToolRequestParams { + pub fn builder() -> builder::CallToolRequestParams { + Default::default() + } +} +#[doc = "The server's response to a tool call.\n\nAny errors that originate from the tool SHOULD be reported inside the result\nobject, with `isError` set to true, _not_ as an MCP protocol-level error\nresponse. Otherwise, the LLM would not be able to see that an error occurred\nand self-correct.\n\nHowever, any errors in _finding_ the tool, an error indicating that the\nserver does not support tool calls, or any other exceptional conditions,\nshould be reported as an MCP error response."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The server's response to a tool call.\\n\\nAny errors that originate from the tool SHOULD be reported inside the result\\nobject, with `isError` set to true, _not_ as an MCP protocol-level error\\nresponse. Otherwise, the LLM would not be able to see that an error occurred\\nand self-correct.\\n\\nHowever, any errors in _finding_ the tool, an error indicating that the\\nserver does not support tool calls, or any other exceptional conditions,\\nshould be reported as an MCP error response.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"content\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"content\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ImageContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/EmbeddedResource\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"isError\": {"] +#[doc = " \"description\": \"Whether the tool call ended in an error.\\n\\nIf not set, this is assumed to be false (the call was successful).\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CallToolResult { + pub content: ::std::vec::Vec, + #[doc = "Whether the tool call ended in an error.\n\nIf not set, this is assumed to be false (the call was successful)."] + #[serde( + rename = "isError", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub is_error: ::std::option::Option, + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&CallToolResult> for CallToolResult { + fn from(value: &CallToolResult) -> Self { + value.clone() + } +} +impl CallToolResult { + pub fn builder() -> builder::CallToolResult { + Default::default() + } +} +#[doc = "CallToolResultContentItem"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ImageContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/EmbeddedResource\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum CallToolResultContentItem { + TextContent(TextContent), + ImageContent(ImageContent), + EmbeddedResource(EmbeddedResource), +} +impl ::std::convert::From<&Self> for CallToolResultContentItem { + fn from(value: &CallToolResultContentItem) -> Self { + value.clone() + } +} +impl ::std::convert::From for CallToolResultContentItem { + fn from(value: TextContent) -> Self { + Self::TextContent(value) + } +} +impl ::std::convert::From for CallToolResultContentItem { + fn from(value: ImageContent) -> Self { + Self::ImageContent(value) + } +} +impl ::std::convert::From for CallToolResultContentItem { + fn from(value: EmbeddedResource) -> Self { + Self::EmbeddedResource(value) + } +} +#[doc = "This notification can be sent by either side to indicate that it is cancelling a previously-issued request.\n\nThe request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.\n\nThis notification indicates that the result will be unused, so any associated processing SHOULD cease.\n\nA client MUST NOT attempt to cancel its `initialize` request."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"This notification can be sent by either side to indicate that it is cancelling a previously-issued request.\\n\\nThe request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.\\n\\nThis notification indicates that the result will be unused, so any associated processing SHOULD cease.\\n\\nA client MUST NOT attempt to cancel its `initialize` request.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"notifications/cancelled\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"requestId\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"reason\": {"] +#[doc = " \"description\": \"An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"requestId\": {"] +#[doc = " \"description\": \"The ID of the request to cancel.\\n\\nThis MUST correspond to the ID of a request previously issued in the same direction.\","] +#[doc = " \"$ref\": \"#/definitions/RequestId\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CancelledNotification { + pub method: ::std::string::String, + pub params: CancelledNotificationParams, +} +impl ::std::convert::From<&CancelledNotification> for CancelledNotification { + fn from(value: &CancelledNotification) -> Self { + value.clone() + } +} +impl CancelledNotification { + pub fn builder() -> builder::CancelledNotification { + Default::default() + } +} +#[doc = "CancelledNotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"requestId\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"reason\": {"] +#[doc = " \"description\": \"An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"requestId\": {"] +#[doc = " \"description\": \"The ID of the request to cancel.\\n\\nThis MUST correspond to the ID of a request previously issued in the same direction.\","] +#[doc = " \"$ref\": \"#/definitions/RequestId\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CancelledNotificationParams { + #[doc = "An optional string describing the reason for the cancellation. This MAY be logged or presented to the user."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub reason: ::std::option::Option<::std::string::String>, + #[doc = "The ID of the request to cancel.\n\nThis MUST correspond to the ID of a request previously issued in the same direction."] + #[serde(rename = "requestId")] + pub request_id: RequestId, +} +impl ::std::convert::From<&CancelledNotificationParams> for CancelledNotificationParams { + fn from(value: &CancelledNotificationParams) -> Self { + value.clone() + } +} +impl CancelledNotificationParams { + pub fn builder() -> builder::CancelledNotificationParams { + Default::default() + } +} +#[doc = "Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"experimental\": {"] +#[doc = " \"description\": \"Experimental, non-standard capabilities that the client supports.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": true"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"roots\": {"] +#[doc = " \"description\": \"Present if the client supports listing roots.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"listChanged\": {"] +#[doc = " \"description\": \"Whether the client supports notifications for changes to the roots list.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"sampling\": {"] +#[doc = " \"description\": \"Present if the client supports sampling from an LLM.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": true"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ClientCapabilities { + #[doc = "Experimental, non-standard capabilities that the client supports."] + #[serde( + default, + skip_serializing_if = ":: std :: collections :: HashMap::is_empty" + )] + pub experimental: ::std::collections::HashMap< + ::std::string::String, + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub roots: ::std::option::Option, + #[doc = "Present if the client supports sampling from an LLM."] + #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] + pub sampling: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&ClientCapabilities> for ClientCapabilities { + fn from(value: &ClientCapabilities) -> Self { + value.clone() + } +} +impl ::std::default::Default for ClientCapabilities { + fn default() -> Self { + Self { + experimental: Default::default(), + roots: Default::default(), + sampling: Default::default(), + } + } +} +impl ClientCapabilities { + pub fn builder() -> builder::ClientCapabilities { + Default::default() + } +} +#[doc = "Present if the client supports listing roots."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Present if the client supports listing roots.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"listChanged\": {"] +#[doc = " \"description\": \"Whether the client supports notifications for changes to the roots list.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ClientCapabilitiesRoots { + #[doc = "Whether the client supports notifications for changes to the roots list."] + #[serde( + rename = "listChanged", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub list_changed: ::std::option::Option, +} +impl ::std::convert::From<&ClientCapabilitiesRoots> for ClientCapabilitiesRoots { + fn from(value: &ClientCapabilitiesRoots) -> Self { + value.clone() + } +} +impl ::std::default::Default for ClientCapabilitiesRoots { + fn default() -> Self { + Self { + list_changed: Default::default(), + } + } +} +impl ClientCapabilitiesRoots { + pub fn builder() -> builder::ClientCapabilitiesRoots { + Default::default() + } +} +#[doc = "ClientNotification"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/CancelledNotification\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/InitializedNotification\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ProgressNotification\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/RootsListChangedNotification\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum ClientNotification { + CancelledNotification(CancelledNotification), + InitializedNotification(InitializedNotification), + ProgressNotification(ProgressNotification), + RootsListChangedNotification(RootsListChangedNotification), +} +impl ::std::convert::From<&Self> for ClientNotification { + fn from(value: &ClientNotification) -> Self { + value.clone() + } +} +impl ::std::convert::From for ClientNotification { + fn from(value: CancelledNotification) -> Self { + Self::CancelledNotification(value) + } +} +impl ::std::convert::From for ClientNotification { + fn from(value: InitializedNotification) -> Self { + Self::InitializedNotification(value) + } +} +impl ::std::convert::From for ClientNotification { + fn from(value: ProgressNotification) -> Self { + Self::ProgressNotification(value) + } +} +impl ::std::convert::From for ClientNotification { + fn from(value: RootsListChangedNotification) -> Self { + Self::RootsListChangedNotification(value) + } +} +#[doc = "ClientRequest"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/InitializeRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/PingRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ListResourcesRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ListResourceTemplatesRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ReadResourceRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/SubscribeRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/UnsubscribeRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ListPromptsRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/GetPromptRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ListToolsRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/CallToolRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/SetLevelRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/CompleteRequest\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum ClientRequest { + InitializeRequest(InitializeRequest), + PingRequest(PingRequest), + ListResourcesRequest(ListResourcesRequest), + ListResourceTemplatesRequest(ListResourceTemplatesRequest), + ReadResourceRequest(ReadResourceRequest), + SubscribeRequest(SubscribeRequest), + UnsubscribeRequest(UnsubscribeRequest), + ListPromptsRequest(ListPromptsRequest), + GetPromptRequest(GetPromptRequest), + ListToolsRequest(ListToolsRequest), + CallToolRequest(CallToolRequest), + SetLevelRequest(SetLevelRequest), + CompleteRequest(CompleteRequest), +} +impl ::std::convert::From<&Self> for ClientRequest { + fn from(value: &ClientRequest) -> Self { + value.clone() + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: InitializeRequest) -> Self { + Self::InitializeRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: PingRequest) -> Self { + Self::PingRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: ListResourcesRequest) -> Self { + Self::ListResourcesRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: ListResourceTemplatesRequest) -> Self { + Self::ListResourceTemplatesRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: ReadResourceRequest) -> Self { + Self::ReadResourceRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: SubscribeRequest) -> Self { + Self::SubscribeRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: UnsubscribeRequest) -> Self { + Self::UnsubscribeRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: ListPromptsRequest) -> Self { + Self::ListPromptsRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: GetPromptRequest) -> Self { + Self::GetPromptRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: ListToolsRequest) -> Self { + Self::ListToolsRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: CallToolRequest) -> Self { + Self::CallToolRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: SetLevelRequest) -> Self { + Self::SetLevelRequest(value) + } +} +impl ::std::convert::From for ClientRequest { + fn from(value: CompleteRequest) -> Self { + Self::CompleteRequest(value) + } +} +#[doc = "ClientResult"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/Result\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/CreateMessageResult\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ListRootsResult\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum ClientResult { + Result(Result), + CreateMessageResult(CreateMessageResult), + ListRootsResult(ListRootsResult), +} +impl ::std::convert::From<&Self> for ClientResult { + fn from(value: &ClientResult) -> Self { + value.clone() + } +} +impl ::std::convert::From for ClientResult { + fn from(value: Result) -> Self { + Self::Result(value) + } +} +impl ::std::convert::From for ClientResult { + fn from(value: CreateMessageResult) -> Self { + Self::CreateMessageResult(value) + } +} +impl ::std::convert::From for ClientResult { + fn from(value: ListRootsResult) -> Self { + Self::ListRootsResult(value) + } +} +#[doc = "A request from the client to the server, to ask for completion options."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A request from the client to the server, to ask for completion options.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"completion/complete\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"argument\","] +#[doc = " \"ref\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"argument\": {"] +#[doc = " \"description\": \"The argument's information\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\","] +#[doc = " \"value\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"The name of the argument\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"value\": {"] +#[doc = " \"description\": \"The value of the argument to use for completion matching.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"ref\": {"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/PromptReference\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ResourceReference\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CompleteRequest { + pub method: ::std::string::String, + pub params: CompleteRequestParams, +} +impl ::std::convert::From<&CompleteRequest> for CompleteRequest { + fn from(value: &CompleteRequest) -> Self { + value.clone() + } +} +impl CompleteRequest { + pub fn builder() -> builder::CompleteRequest { + Default::default() + } +} +#[doc = "CompleteRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"argument\","] +#[doc = " \"ref\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"argument\": {"] +#[doc = " \"description\": \"The argument's information\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\","] +#[doc = " \"value\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"The name of the argument\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"value\": {"] +#[doc = " \"description\": \"The value of the argument to use for completion matching.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"ref\": {"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/PromptReference\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ResourceReference\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CompleteRequestParams { + pub argument: CompleteRequestParamsArgument, + #[serde(rename = "ref")] + pub ref_: CompleteRequestParamsRef, +} +impl ::std::convert::From<&CompleteRequestParams> for CompleteRequestParams { + fn from(value: &CompleteRequestParams) -> Self { + value.clone() + } +} +impl CompleteRequestParams { + pub fn builder() -> builder::CompleteRequestParams { + Default::default() + } +} +#[doc = "The argument's information"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The argument's information\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\","] +#[doc = " \"value\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"The name of the argument\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"value\": {"] +#[doc = " \"description\": \"The value of the argument to use for completion matching.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CompleteRequestParamsArgument { + #[doc = "The name of the argument"] + pub name: ::std::string::String, + #[doc = "The value of the argument to use for completion matching."] + pub value: ::std::string::String, +} +impl ::std::convert::From<&CompleteRequestParamsArgument> for CompleteRequestParamsArgument { + fn from(value: &CompleteRequestParamsArgument) -> Self { + value.clone() + } +} +impl CompleteRequestParamsArgument { + pub fn builder() -> builder::CompleteRequestParamsArgument { + Default::default() + } +} +#[doc = "CompleteRequestParamsRef"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/PromptReference\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ResourceReference\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum CompleteRequestParamsRef { + PromptReference(PromptReference), + ResourceReference(ResourceReference), +} +impl ::std::convert::From<&Self> for CompleteRequestParamsRef { + fn from(value: &CompleteRequestParamsRef) -> Self { + value.clone() + } +} +impl ::std::convert::From for CompleteRequestParamsRef { + fn from(value: PromptReference) -> Self { + Self::PromptReference(value) + } +} +impl ::std::convert::From for CompleteRequestParamsRef { + fn from(value: ResourceReference) -> Self { + Self::ResourceReference(value) + } +} +#[doc = "The server's response to a completion/complete request"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The server's response to a completion/complete request\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"completion\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"completion\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"values\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"hasMore\": {"] +#[doc = " \"description\": \"Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " },"] +#[doc = " \"total\": {"] +#[doc = " \"description\": \"The total number of completion options available. This can exceed the number of values actually sent in the response.\","] +#[doc = " \"type\": \"integer\""] +#[doc = " },"] +#[doc = " \"values\": {"] +#[doc = " \"description\": \"An array of completion values. Must not exceed 100 items.\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CompleteResult { + pub completion: CompleteResultCompletion, + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&CompleteResult> for CompleteResult { + fn from(value: &CompleteResult) -> Self { + value.clone() + } +} +impl CompleteResult { + pub fn builder() -> builder::CompleteResult { + Default::default() + } +} +#[doc = "CompleteResultCompletion"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"values\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"hasMore\": {"] +#[doc = " \"description\": \"Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " },"] +#[doc = " \"total\": {"] +#[doc = " \"description\": \"The total number of completion options available. This can exceed the number of values actually sent in the response.\","] +#[doc = " \"type\": \"integer\""] +#[doc = " },"] +#[doc = " \"values\": {"] +#[doc = " \"description\": \"An array of completion values. Must not exceed 100 items.\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CompleteResultCompletion { + #[doc = "Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown."] + #[serde( + rename = "hasMore", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub has_more: ::std::option::Option, + #[doc = "The total number of completion options available. This can exceed the number of values actually sent in the response."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub total: ::std::option::Option, + #[doc = "An array of completion values. Must not exceed 100 items."] + pub values: ::std::vec::Vec<::std::string::String>, +} +impl ::std::convert::From<&CompleteResultCompletion> for CompleteResultCompletion { + fn from(value: &CompleteResultCompletion) -> Self { + value.clone() + } +} +impl CompleteResultCompletion { + pub fn builder() -> builder::CompleteResultCompletion { + Default::default() + } +} +#[doc = "A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"sampling/createMessage\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"maxTokens\","] +#[doc = " \"messages\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"includeContext\": {"] +#[doc = " \"description\": \"A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"enum\": ["] +#[doc = " \"allServers\","] +#[doc = " \"none\","] +#[doc = " \"thisServer\""] +#[doc = " ]"] +#[doc = " },"] +#[doc = " \"maxTokens\": {"] +#[doc = " \"description\": \"The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.\","] +#[doc = " \"type\": \"integer\""] +#[doc = " },"] +#[doc = " \"messages\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/SamplingMessage\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"metadata\": {"] +#[doc = " \"description\": \"Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": true"] +#[doc = " },"] +#[doc = " \"modelPreferences\": {"] +#[doc = " \"description\": \"The server's preferences for which model to select. The client MAY ignore these preferences.\","] +#[doc = " \"$ref\": \"#/definitions/ModelPreferences\""] +#[doc = " },"] +#[doc = " \"stopSequences\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"systemPrompt\": {"] +#[doc = " \"description\": \"An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"temperature\": {"] +#[doc = " \"type\": \"number\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CreateMessageRequest { + pub method: ::std::string::String, + pub params: CreateMessageRequestParams, +} +impl ::std::convert::From<&CreateMessageRequest> for CreateMessageRequest { + fn from(value: &CreateMessageRequest) -> Self { + value.clone() + } +} +impl CreateMessageRequest { + pub fn builder() -> builder::CreateMessageRequest { + Default::default() + } +} +#[doc = "CreateMessageRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"maxTokens\","] +#[doc = " \"messages\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"includeContext\": {"] +#[doc = " \"description\": \"A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"enum\": ["] +#[doc = " \"allServers\","] +#[doc = " \"none\","] +#[doc = " \"thisServer\""] +#[doc = " ]"] +#[doc = " },"] +#[doc = " \"maxTokens\": {"] +#[doc = " \"description\": \"The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.\","] +#[doc = " \"type\": \"integer\""] +#[doc = " },"] +#[doc = " \"messages\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/SamplingMessage\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"metadata\": {"] +#[doc = " \"description\": \"Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": true"] +#[doc = " },"] +#[doc = " \"modelPreferences\": {"] +#[doc = " \"description\": \"The server's preferences for which model to select. The client MAY ignore these preferences.\","] +#[doc = " \"$ref\": \"#/definitions/ModelPreferences\""] +#[doc = " },"] +#[doc = " \"stopSequences\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"systemPrompt\": {"] +#[doc = " \"description\": \"An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"temperature\": {"] +#[doc = " \"type\": \"number\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CreateMessageRequestParams { + #[doc = "A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request."] + #[serde( + rename = "includeContext", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub include_context: ::std::option::Option, + #[doc = "The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested."] + #[serde(rename = "maxTokens")] + pub max_tokens: i64, + pub messages: ::std::vec::Vec, + #[doc = "Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific."] + #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] + pub metadata: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + #[doc = "The server's preferences for which model to select. The client MAY ignore these preferences."] + #[serde( + rename = "modelPreferences", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub model_preferences: ::std::option::Option, + #[serde( + rename = "stopSequences", + default, + skip_serializing_if = "::std::vec::Vec::is_empty" + )] + pub stop_sequences: ::std::vec::Vec<::std::string::String>, + #[doc = "An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt."] + #[serde( + rename = "systemPrompt", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub system_prompt: ::std::option::Option<::std::string::String>, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub temperature: ::std::option::Option, +} +impl ::std::convert::From<&CreateMessageRequestParams> for CreateMessageRequestParams { + fn from(value: &CreateMessageRequestParams) -> Self { + value.clone() + } +} +impl CreateMessageRequestParams { + pub fn builder() -> builder::CreateMessageRequestParams { + Default::default() + } +} +#[doc = "A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"enum\": ["] +#[doc = " \"allServers\","] +#[doc = " \"none\","] +#[doc = " \"thisServer\""] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive( + :: serde :: Deserialize, + :: serde :: Serialize, + Clone, + Copy, + Debug, + Eq, + Hash, + Ord, + PartialEq, + PartialOrd, +)] +pub enum CreateMessageRequestParamsIncludeContext { + #[serde(rename = "allServers")] + AllServers, + #[serde(rename = "none")] + None, + #[serde(rename = "thisServer")] + ThisServer, +} +impl ::std::convert::From<&Self> for CreateMessageRequestParamsIncludeContext { + fn from(value: &CreateMessageRequestParamsIncludeContext) -> Self { + value.clone() + } +} +impl ::std::fmt::Display for CreateMessageRequestParamsIncludeContext { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match *self { + Self::AllServers => write!(f, "allServers"), + Self::None => write!(f, "none"), + Self::ThisServer => write!(f, "thisServer"), + } + } +} +impl ::std::str::FromStr for CreateMessageRequestParamsIncludeContext { + type Err = self::error::ConversionError; + fn from_str(value: &str) -> ::std::result::Result { + match value { + "allServers" => Ok(Self::AllServers), + "none" => Ok(Self::None), + "thisServer" => Ok(Self::ThisServer), + _ => Err("invalid value".into()), + } + } +} +impl ::std::convert::TryFrom<&str> for CreateMessageRequestParamsIncludeContext { + type Error = self::error::ConversionError; + fn try_from(value: &str) -> ::std::result::Result { + value.parse() + } +} +impl ::std::convert::TryFrom<&::std::string::String> for CreateMessageRequestParamsIncludeContext { + type Error = self::error::ConversionError; + fn try_from( + value: &::std::string::String, + ) -> ::std::result::Result { + value.parse() + } +} +impl ::std::convert::TryFrom<::std::string::String> for CreateMessageRequestParamsIncludeContext { + type Error = self::error::ConversionError; + fn try_from( + value: ::std::string::String, + ) -> ::std::result::Result { + value.parse() + } +} +#[doc = "The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"content\","] +#[doc = " \"model\","] +#[doc = " \"role\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"content\": {"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ImageContent\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = " },"] +#[doc = " \"model\": {"] +#[doc = " \"description\": \"The name of the model that generated the message.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"role\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " },"] +#[doc = " \"stopReason\": {"] +#[doc = " \"description\": \"The reason why sampling stopped, if known.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct CreateMessageResult { + pub content: CreateMessageResultContent, + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + #[doc = "The name of the model that generated the message."] + pub model: ::std::string::String, + pub role: Role, + #[doc = "The reason why sampling stopped, if known."] + #[serde( + rename = "stopReason", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub stop_reason: ::std::option::Option<::std::string::String>, +} +impl ::std::convert::From<&CreateMessageResult> for CreateMessageResult { + fn from(value: &CreateMessageResult) -> Self { + value.clone() + } +} +impl CreateMessageResult { + pub fn builder() -> builder::CreateMessageResult { + Default::default() + } +} +#[doc = "CreateMessageResultContent"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ImageContent\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum CreateMessageResultContent { + TextContent(TextContent), + ImageContent(ImageContent), +} +impl ::std::convert::From<&Self> for CreateMessageResultContent { + fn from(value: &CreateMessageResultContent) -> Self { + value.clone() + } +} +impl ::std::convert::From for CreateMessageResultContent { + fn from(value: TextContent) -> Self { + Self::TextContent(value) + } +} +impl ::std::convert::From for CreateMessageResultContent { + fn from(value: ImageContent) -> Self { + Self::ImageContent(value) + } +} +#[doc = "An opaque token used to represent a cursor for pagination."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"An opaque token used to represent a cursor for pagination.\","] +#[doc = " \"type\": \"string\""] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive( + :: serde :: Deserialize, + :: serde :: Serialize, + Clone, + Debug, + Eq, + Hash, + Ord, + PartialEq, + PartialOrd, +)] +#[serde(transparent)] +pub struct Cursor(pub ::std::string::String); +impl ::std::ops::Deref for Cursor { + type Target = ::std::string::String; + fn deref(&self) -> &::std::string::String { + &self.0 + } +} +impl ::std::convert::From for ::std::string::String { + fn from(value: Cursor) -> Self { + value.0 + } +} +impl ::std::convert::From<&Cursor> for Cursor { + fn from(value: &Cursor) -> Self { + value.clone() + } +} +impl ::std::convert::From<::std::string::String> for Cursor { + fn from(value: ::std::string::String) -> Self { + Self(value) + } +} +impl ::std::str::FromStr for Cursor { + type Err = ::std::convert::Infallible; + fn from_str(value: &str) -> ::std::result::Result { + Ok(Self(value.to_string())) + } +} +impl ::std::fmt::Display for Cursor { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + self.0.fmt(f) + } +} +#[doc = "The contents of a resource, embedded into a prompt or tool call result.\n\nIt is up to the client how best to render embedded resources for the benefit\nof the LLM and/or the user."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The contents of a resource, embedded into a prompt or tool call result.\\n\\nIt is up to the client how best to render embedded resources for the benefit\\nof the LLM and/or the user.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"resource\","] +#[doc = " \"type\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"annotations\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"resource\": {"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextResourceContents\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/BlobResourceContents\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = " },"] +#[doc = " \"type\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"resource\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct EmbeddedResource { + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub annotations: ::std::option::Option, + pub resource: EmbeddedResourceResource, + #[serde(rename = "type")] + pub type_: ::std::string::String, +} +impl ::std::convert::From<&EmbeddedResource> for EmbeddedResource { + fn from(value: &EmbeddedResource) -> Self { + value.clone() + } +} +impl EmbeddedResource { + pub fn builder() -> builder::EmbeddedResource { + Default::default() + } +} +#[doc = "EmbeddedResourceAnnotations"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct EmbeddedResourceAnnotations { + #[doc = "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`)."] + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] + pub audience: ::std::vec::Vec, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub priority: ::std::option::Option, +} +impl ::std::convert::From<&EmbeddedResourceAnnotations> for EmbeddedResourceAnnotations { + fn from(value: &EmbeddedResourceAnnotations) -> Self { + value.clone() + } +} +impl ::std::default::Default for EmbeddedResourceAnnotations { + fn default() -> Self { + Self { + audience: Default::default(), + priority: Default::default(), + } + } +} +impl EmbeddedResourceAnnotations { + pub fn builder() -> builder::EmbeddedResourceAnnotations { + Default::default() + } +} +#[doc = "EmbeddedResourceResource"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextResourceContents\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/BlobResourceContents\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum EmbeddedResourceResource { + TextResourceContents(TextResourceContents), + BlobResourceContents(BlobResourceContents), +} +impl ::std::convert::From<&Self> for EmbeddedResourceResource { + fn from(value: &EmbeddedResourceResource) -> Self { + value.clone() + } +} +impl ::std::convert::From for EmbeddedResourceResource { + fn from(value: TextResourceContents) -> Self { + Self::TextResourceContents(value) + } +} +impl ::std::convert::From for EmbeddedResourceResource { + fn from(value: BlobResourceContents) -> Self { + Self::BlobResourceContents(value) + } +} +#[doc = "EmptyResult"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"$ref\": \"#/definitions/Result\""] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(transparent)] +pub struct EmptyResult(pub Result); +impl ::std::ops::Deref for EmptyResult { + type Target = Result; + fn deref(&self) -> &Result { + &self.0 + } +} +impl ::std::convert::From for Result { + fn from(value: EmptyResult) -> Self { + value.0 + } +} +impl ::std::convert::From<&EmptyResult> for EmptyResult { + fn from(value: &EmptyResult) -> Self { + value.clone() + } +} +impl ::std::convert::From for EmptyResult { + fn from(value: Result) -> Self { + Self(value) + } +} +#[doc = "Used by the client to get a prompt provided by the server."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Used by the client to get a prompt provided by the server.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"prompts/get\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"arguments\": {"] +#[doc = " \"description\": \"Arguments to use for templating the prompt.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"The name of the prompt or prompt template.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct GetPromptRequest { + pub method: ::std::string::String, + pub params: GetPromptRequestParams, +} +impl ::std::convert::From<&GetPromptRequest> for GetPromptRequest { + fn from(value: &GetPromptRequest) -> Self { + value.clone() + } +} +impl GetPromptRequest { + pub fn builder() -> builder::GetPromptRequest { + Default::default() + } +} +#[doc = "GetPromptRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"arguments\": {"] +#[doc = " \"description\": \"Arguments to use for templating the prompt.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"The name of the prompt or prompt template.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct GetPromptRequestParams { + #[doc = "Arguments to use for templating the prompt."] + #[serde( + default, + skip_serializing_if = ":: std :: collections :: HashMap::is_empty" + )] + pub arguments: ::std::collections::HashMap<::std::string::String, ::std::string::String>, + #[doc = "The name of the prompt or prompt template."] + pub name: ::std::string::String, +} +impl ::std::convert::From<&GetPromptRequestParams> for GetPromptRequestParams { + fn from(value: &GetPromptRequestParams) -> Self { + value.clone() + } +} +impl GetPromptRequestParams { + pub fn builder() -> builder::GetPromptRequestParams { + Default::default() + } +} +#[doc = "The server's response to a prompts/get request from the client."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The server's response to a prompts/get request from the client.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"messages\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"description\": {"] +#[doc = " \"description\": \"An optional description for the prompt.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"messages\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/PromptMessage\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct GetPromptResult { + #[doc = "An optional description for the prompt."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub description: ::std::option::Option<::std::string::String>, + pub messages: ::std::vec::Vec, + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&GetPromptResult> for GetPromptResult { + fn from(value: &GetPromptResult) -> Self { + value.clone() + } +} +impl GetPromptResult { + pub fn builder() -> builder::GetPromptResult { + Default::default() + } +} +#[doc = "An image provided to or from an LLM."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"An image provided to or from an LLM.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"data\","] +#[doc = " \"mimeType\","] +#[doc = " \"type\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"annotations\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"data\": {"] +#[doc = " \"description\": \"The base64-encoded image data.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"byte\""] +#[doc = " },"] +#[doc = " \"mimeType\": {"] +#[doc = " \"description\": \"The MIME type of the image. Different providers may support different image types.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"type\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"image\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ImageContent { + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub annotations: ::std::option::Option, + #[doc = "The base64-encoded image data."] + pub data: ::std::string::String, + #[doc = "The MIME type of the image. Different providers may support different image types."] + #[serde(rename = "mimeType")] + pub mime_type: ::std::string::String, + #[serde(rename = "type")] + pub type_: ::std::string::String, +} +impl ::std::convert::From<&ImageContent> for ImageContent { + fn from(value: &ImageContent) -> Self { + value.clone() + } +} +impl ImageContent { + pub fn builder() -> builder::ImageContent { + Default::default() + } +} +#[doc = "ImageContentAnnotations"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ImageContentAnnotations { + #[doc = "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`)."] + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] + pub audience: ::std::vec::Vec, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub priority: ::std::option::Option, +} +impl ::std::convert::From<&ImageContentAnnotations> for ImageContentAnnotations { + fn from(value: &ImageContentAnnotations) -> Self { + value.clone() + } +} +impl ::std::default::Default for ImageContentAnnotations { + fn default() -> Self { + Self { + audience: Default::default(), + priority: Default::default(), + } + } +} +impl ImageContentAnnotations { + pub fn builder() -> builder::ImageContentAnnotations { + Default::default() + } +} +#[doc = "Describes the name and version of an MCP implementation."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Describes the name and version of an MCP implementation.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\","] +#[doc = " \"version\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"name\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"version\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct Implementation { + pub name: ::std::string::String, + pub version: ::std::string::String, +} +impl ::std::convert::From<&Implementation> for Implementation { + fn from(value: &Implementation) -> Self { + value.clone() + } +} +impl Implementation { + pub fn builder() -> builder::Implementation { + Default::default() + } +} +#[doc = "This request is sent from the client to the server when it first connects, asking it to begin initialization."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"This request is sent from the client to the server when it first connects, asking it to begin initialization.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"initialize\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"capabilities\","] +#[doc = " \"clientInfo\","] +#[doc = " \"protocolVersion\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"capabilities\": {"] +#[doc = " \"$ref\": \"#/definitions/ClientCapabilities\""] +#[doc = " },"] +#[doc = " \"clientInfo\": {"] +#[doc = " \"$ref\": \"#/definitions/Implementation\""] +#[doc = " },"] +#[doc = " \"protocolVersion\": {"] +#[doc = " \"description\": \"The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct InitializeRequest { + pub method: ::std::string::String, + pub params: InitializeRequestParams, +} +impl ::std::convert::From<&InitializeRequest> for InitializeRequest { + fn from(value: &InitializeRequest) -> Self { + value.clone() + } +} +impl InitializeRequest { + pub fn builder() -> builder::InitializeRequest { + Default::default() + } +} +#[doc = "InitializeRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"capabilities\","] +#[doc = " \"clientInfo\","] +#[doc = " \"protocolVersion\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"capabilities\": {"] +#[doc = " \"$ref\": \"#/definitions/ClientCapabilities\""] +#[doc = " },"] +#[doc = " \"clientInfo\": {"] +#[doc = " \"$ref\": \"#/definitions/Implementation\""] +#[doc = " },"] +#[doc = " \"protocolVersion\": {"] +#[doc = " \"description\": \"The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct InitializeRequestParams { + pub capabilities: ClientCapabilities, + #[serde(rename = "clientInfo")] + pub client_info: Implementation, + #[doc = "The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well."] + #[serde(rename = "protocolVersion")] + pub protocol_version: ::std::string::String, +} +impl ::std::convert::From<&InitializeRequestParams> for InitializeRequestParams { + fn from(value: &InitializeRequestParams) -> Self { + value.clone() + } +} +impl InitializeRequestParams { + pub fn builder() -> builder::InitializeRequestParams { + Default::default() + } +} +#[doc = "After receiving an initialize request from the client, the server sends this response."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"After receiving an initialize request from the client, the server sends this response.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"capabilities\","] +#[doc = " \"protocolVersion\","] +#[doc = " \"serverInfo\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"capabilities\": {"] +#[doc = " \"$ref\": \"#/definitions/ServerCapabilities\""] +#[doc = " },"] +#[doc = " \"instructions\": {"] +#[doc = " \"description\": \"Instructions describing how to use the server and its features.\\n\\nThis can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a \\\"hint\\\" to the model. For example, this information MAY be added to the system prompt.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"protocolVersion\": {"] +#[doc = " \"description\": \"The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"serverInfo\": {"] +#[doc = " \"$ref\": \"#/definitions/Implementation\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct InitializeResult { + pub capabilities: ServerCapabilities, + #[doc = "Instructions describing how to use the server and its features.\n\nThis can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a \"hint\" to the model. For example, this information MAY be added to the system prompt."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub instructions: ::std::option::Option<::std::string::String>, + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + #[doc = "The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect."] + #[serde(rename = "protocolVersion")] + pub protocol_version: ::std::string::String, + #[serde(rename = "serverInfo")] + pub server_info: Implementation, +} +impl ::std::convert::From<&InitializeResult> for InitializeResult { + fn from(value: &InitializeResult) -> Self { + value.clone() + } +} +impl InitializeResult { + pub fn builder() -> builder::InitializeResult { + Default::default() + } +} +#[doc = "This notification is sent from the client to the server after initialization has finished."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"This notification is sent from the client to the server after initialization has finished.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"notifications/initialized\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct InitializedNotification { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&InitializedNotification> for InitializedNotification { + fn from(value: &InitializedNotification) -> Self { + value.clone() + } +} +impl InitializedNotification { + pub fn builder() -> builder::InitializedNotification { + Default::default() + } +} +#[doc = "InitializedNotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct InitializedNotificationParams { + #[doc = "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&InitializedNotificationParams> for InitializedNotificationParams { + fn from(value: &InitializedNotificationParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for InitializedNotificationParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl InitializedNotificationParams { + pub fn builder() -> builder::InitializedNotificationParams { + Default::default() + } +} +#[doc = "A response to a request that indicates an error occurred."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A response to a request that indicates an error occurred.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"error\","] +#[doc = " \"id\","] +#[doc = " \"jsonrpc\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"error\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"code\","] +#[doc = " \"message\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"code\": {"] +#[doc = " \"description\": \"The error type that occurred.\","] +#[doc = " \"type\": \"integer\""] +#[doc = " },"] +#[doc = " \"data\": {"] +#[doc = " \"description\": \"Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).\""] +#[doc = " },"] +#[doc = " \"message\": {"] +#[doc = " \"description\": \"A short description of the error. The message SHOULD be limited to a concise single sentence.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"id\": {"] +#[doc = " \"$ref\": \"#/definitions/RequestId\""] +#[doc = " },"] +#[doc = " \"jsonrpc\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"2.0\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct JsonrpcError { + pub error: JsonrpcErrorError, + pub id: RequestId, + pub jsonrpc: ::std::string::String, +} +impl ::std::convert::From<&JsonrpcError> for JsonrpcError { + fn from(value: &JsonrpcError) -> Self { + value.clone() + } +} +impl JsonrpcError { + pub fn builder() -> builder::JsonrpcError { + Default::default() + } +} +#[doc = "JsonrpcErrorError"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"code\","] +#[doc = " \"message\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"code\": {"] +#[doc = " \"description\": \"The error type that occurred.\","] +#[doc = " \"type\": \"integer\""] +#[doc = " },"] +#[doc = " \"data\": {"] +#[doc = " \"description\": \"Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).\""] +#[doc = " },"] +#[doc = " \"message\": {"] +#[doc = " \"description\": \"A short description of the error. The message SHOULD be limited to a concise single sentence.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct JsonrpcErrorError { + #[doc = "The error type that occurred."] + pub code: i64, + #[doc = "Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.)."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub data: ::std::option::Option<::serde_json::Value>, + #[doc = "A short description of the error. The message SHOULD be limited to a concise single sentence."] + pub message: ::std::string::String, +} +impl ::std::convert::From<&JsonrpcErrorError> for JsonrpcErrorError { + fn from(value: &JsonrpcErrorError) -> Self { + value.clone() + } +} +impl JsonrpcErrorError { + pub fn builder() -> builder::JsonrpcErrorError { + Default::default() + } +} +#[doc = "JsonrpcMessage"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/JSONRPCRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/JSONRPCNotification\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/JSONRPCResponse\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/JSONRPCError\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum JsonrpcMessage { + Request(JsonrpcRequest), + Notification(JsonrpcNotification), + Response(JsonrpcResponse), + Error(JsonrpcError), +} +impl ::std::convert::From<&Self> for JsonrpcMessage { + fn from(value: &JsonrpcMessage) -> Self { + value.clone() + } +} +impl ::std::convert::From for JsonrpcMessage { + fn from(value: JsonrpcRequest) -> Self { + Self::Request(value) + } +} +impl ::std::convert::From for JsonrpcMessage { + fn from(value: JsonrpcNotification) -> Self { + Self::Notification(value) + } +} +impl ::std::convert::From for JsonrpcMessage { + fn from(value: JsonrpcResponse) -> Self { + Self::Response(value) + } +} +impl ::std::convert::From for JsonrpcMessage { + fn from(value: JsonrpcError) -> Self { + Self::Error(value) + } +} +#[doc = "A notification which does not expect a response."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A notification which does not expect a response.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"jsonrpc\","] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"jsonrpc\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"2.0\""] +#[doc = " },"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct JsonrpcNotification { + pub jsonrpc: ::std::string::String, + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&JsonrpcNotification> for JsonrpcNotification { + fn from(value: &JsonrpcNotification) -> Self { + value.clone() + } +} +impl JsonrpcNotification { + pub fn builder() -> builder::JsonrpcNotification { + Default::default() + } +} +#[doc = "JsonrpcNotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct JsonrpcNotificationParams { + #[doc = "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&JsonrpcNotificationParams> for JsonrpcNotificationParams { + fn from(value: &JsonrpcNotificationParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for JsonrpcNotificationParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl JsonrpcNotificationParams { + pub fn builder() -> builder::JsonrpcNotificationParams { + Default::default() + } +} +#[doc = "A request that expects a response."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A request that expects a response.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"id\","] +#[doc = " \"jsonrpc\","] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"id\": {"] +#[doc = " \"$ref\": \"#/definitions/RequestId\""] +#[doc = " },"] +#[doc = " \"jsonrpc\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"2.0\""] +#[doc = " },"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct JsonrpcRequest { + pub id: RequestId, + pub jsonrpc: ::std::string::String, + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&JsonrpcRequest> for JsonrpcRequest { + fn from(value: &JsonrpcRequest) -> Self { + value.clone() + } +} +impl JsonrpcRequest { + pub fn builder() -> builder::JsonrpcRequest { + Default::default() + } +} +#[doc = "JsonrpcRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct JsonrpcRequestParams { + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub meta: ::std::option::Option, +} +impl ::std::convert::From<&JsonrpcRequestParams> for JsonrpcRequestParams { + fn from(value: &JsonrpcRequestParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for JsonrpcRequestParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl JsonrpcRequestParams { + pub fn builder() -> builder::JsonrpcRequestParams { + Default::default() + } +} +#[doc = "JsonrpcRequestParamsMeta"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct JsonrpcRequestParamsMeta { + #[doc = "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications."] + #[serde( + rename = "progressToken", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub progress_token: ::std::option::Option, +} +impl ::std::convert::From<&JsonrpcRequestParamsMeta> for JsonrpcRequestParamsMeta { + fn from(value: &JsonrpcRequestParamsMeta) -> Self { + value.clone() + } +} +impl ::std::default::Default for JsonrpcRequestParamsMeta { + fn default() -> Self { + Self { + progress_token: Default::default(), + } + } +} +impl JsonrpcRequestParamsMeta { + pub fn builder() -> builder::JsonrpcRequestParamsMeta { + Default::default() + } +} +#[doc = "A successful (non-error) response to a request."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A successful (non-error) response to a request.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"id\","] +#[doc = " \"jsonrpc\","] +#[doc = " \"result\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"id\": {"] +#[doc = " \"$ref\": \"#/definitions/RequestId\""] +#[doc = " },"] +#[doc = " \"jsonrpc\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"2.0\""] +#[doc = " },"] +#[doc = " \"result\": {"] +#[doc = " \"$ref\": \"#/definitions/Result\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct JsonrpcResponse { + pub id: RequestId, + pub jsonrpc: ::std::string::String, + pub result: Result, +} +impl ::std::convert::From<&JsonrpcResponse> for JsonrpcResponse { + fn from(value: &JsonrpcResponse) -> Self { + value.clone() + } +} +impl JsonrpcResponse { + pub fn builder() -> builder::JsonrpcResponse { + Default::default() + } +} +#[doc = "Sent from the client to request a list of prompts and prompt templates the server has."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Sent from the client to request a list of prompts and prompt templates the server has.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"prompts/list\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"cursor\": {"] +#[doc = " \"description\": \"An opaque token representing the current pagination position.\\nIf provided, the server should return results starting after this cursor.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListPromptsRequest { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&ListPromptsRequest> for ListPromptsRequest { + fn from(value: &ListPromptsRequest) -> Self { + value.clone() + } +} +impl ListPromptsRequest { + pub fn builder() -> builder::ListPromptsRequest { + Default::default() + } +} +#[doc = "ListPromptsRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"cursor\": {"] +#[doc = " \"description\": \"An opaque token representing the current pagination position.\\nIf provided, the server should return results starting after this cursor.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListPromptsRequestParams { + #[doc = "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ::std::convert::From<&ListPromptsRequestParams> for ListPromptsRequestParams { + fn from(value: &ListPromptsRequestParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for ListPromptsRequestParams { + fn default() -> Self { + Self { + cursor: Default::default(), + } + } +} +impl ListPromptsRequestParams { + pub fn builder() -> builder::ListPromptsRequestParams { + Default::default() + } +} +#[doc = "The server's response to a prompts/list request from the client."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The server's response to a prompts/list request from the client.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"prompts\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"nextCursor\": {"] +#[doc = " \"description\": \"An opaque token representing the pagination position after the last returned result.\\nIf present, there may be more results available.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"prompts\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Prompt\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListPromptsResult { + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + #[doc = "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available."] + #[serde( + rename = "nextCursor", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub next_cursor: ::std::option::Option<::std::string::String>, + pub prompts: ::std::vec::Vec, +} +impl ::std::convert::From<&ListPromptsResult> for ListPromptsResult { + fn from(value: &ListPromptsResult) -> Self { + value.clone() + } +} +impl ListPromptsResult { + pub fn builder() -> builder::ListPromptsResult { + Default::default() + } +} +#[doc = "Sent from the client to request a list of resource templates the server has."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Sent from the client to request a list of resource templates the server has.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"resources/templates/list\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"cursor\": {"] +#[doc = " \"description\": \"An opaque token representing the current pagination position.\\nIf provided, the server should return results starting after this cursor.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListResourceTemplatesRequest { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&ListResourceTemplatesRequest> for ListResourceTemplatesRequest { + fn from(value: &ListResourceTemplatesRequest) -> Self { + value.clone() + } +} +impl ListResourceTemplatesRequest { + pub fn builder() -> builder::ListResourceTemplatesRequest { + Default::default() + } +} +#[doc = "ListResourceTemplatesRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"cursor\": {"] +#[doc = " \"description\": \"An opaque token representing the current pagination position.\\nIf provided, the server should return results starting after this cursor.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListResourceTemplatesRequestParams { + #[doc = "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ::std::convert::From<&ListResourceTemplatesRequestParams> + for ListResourceTemplatesRequestParams +{ + fn from(value: &ListResourceTemplatesRequestParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for ListResourceTemplatesRequestParams { + fn default() -> Self { + Self { + cursor: Default::default(), + } + } +} +impl ListResourceTemplatesRequestParams { + pub fn builder() -> builder::ListResourceTemplatesRequestParams { + Default::default() + } +} +#[doc = "The server's response to a resources/templates/list request from the client."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The server's response to a resources/templates/list request from the client.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"resourceTemplates\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"nextCursor\": {"] +#[doc = " \"description\": \"An opaque token representing the pagination position after the last returned result.\\nIf present, there may be more results available.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"resourceTemplates\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/ResourceTemplate\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListResourceTemplatesResult { + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + #[doc = "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available."] + #[serde( + rename = "nextCursor", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub next_cursor: ::std::option::Option<::std::string::String>, + #[serde(rename = "resourceTemplates")] + pub resource_templates: ::std::vec::Vec, +} +impl ::std::convert::From<&ListResourceTemplatesResult> for ListResourceTemplatesResult { + fn from(value: &ListResourceTemplatesResult) -> Self { + value.clone() + } +} +impl ListResourceTemplatesResult { + pub fn builder() -> builder::ListResourceTemplatesResult { + Default::default() + } +} +#[doc = "Sent from the client to request a list of resources the server has."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Sent from the client to request a list of resources the server has.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"resources/list\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"cursor\": {"] +#[doc = " \"description\": \"An opaque token representing the current pagination position.\\nIf provided, the server should return results starting after this cursor.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListResourcesRequest { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&ListResourcesRequest> for ListResourcesRequest { + fn from(value: &ListResourcesRequest) -> Self { + value.clone() + } +} +impl ListResourcesRequest { + pub fn builder() -> builder::ListResourcesRequest { + Default::default() + } +} +#[doc = "ListResourcesRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"cursor\": {"] +#[doc = " \"description\": \"An opaque token representing the current pagination position.\\nIf provided, the server should return results starting after this cursor.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListResourcesRequestParams { + #[doc = "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ::std::convert::From<&ListResourcesRequestParams> for ListResourcesRequestParams { + fn from(value: &ListResourcesRequestParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for ListResourcesRequestParams { + fn default() -> Self { + Self { + cursor: Default::default(), + } + } +} +impl ListResourcesRequestParams { + pub fn builder() -> builder::ListResourcesRequestParams { + Default::default() + } +} +#[doc = "The server's response to a resources/list request from the client."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The server's response to a resources/list request from the client.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"resources\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"nextCursor\": {"] +#[doc = " \"description\": \"An opaque token representing the pagination position after the last returned result.\\nIf present, there may be more results available.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"resources\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Resource\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListResourcesResult { + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + #[doc = "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available."] + #[serde( + rename = "nextCursor", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub next_cursor: ::std::option::Option<::std::string::String>, + pub resources: ::std::vec::Vec, +} +impl ::std::convert::From<&ListResourcesResult> for ListResourcesResult { + fn from(value: &ListResourcesResult) -> Self { + value.clone() + } +} +impl ListResourcesResult { + pub fn builder() -> builder::ListResourcesResult { + Default::default() + } +} +#[doc = "Sent from the server to request a list of root URIs from the client. Roots allow\nservers to ask for specific directories or files to operate on. A common example\nfor roots is providing a set of repositories or directories a server should operate\non.\n\nThis request is typically used when the server needs to understand the file system\nstructure or access specific locations that the client has permission to read from."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Sent from the server to request a list of root URIs from the client. Roots allow\\nservers to ask for specific directories or files to operate on. A common example\\nfor roots is providing a set of repositories or directories a server should operate\\non.\\n\\nThis request is typically used when the server needs to understand the file system\\nstructure or access specific locations that the client has permission to read from.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"roots/list\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListRootsRequest { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&ListRootsRequest> for ListRootsRequest { + fn from(value: &ListRootsRequest) -> Self { + value.clone() + } +} +impl ListRootsRequest { + pub fn builder() -> builder::ListRootsRequest { + Default::default() + } +} +#[doc = "ListRootsRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListRootsRequestParams { + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub meta: ::std::option::Option, +} +impl ::std::convert::From<&ListRootsRequestParams> for ListRootsRequestParams { + fn from(value: &ListRootsRequestParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for ListRootsRequestParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl ListRootsRequestParams { + pub fn builder() -> builder::ListRootsRequestParams { + Default::default() + } +} +#[doc = "ListRootsRequestParamsMeta"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListRootsRequestParamsMeta { + #[doc = "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications."] + #[serde( + rename = "progressToken", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub progress_token: ::std::option::Option, +} +impl ::std::convert::From<&ListRootsRequestParamsMeta> for ListRootsRequestParamsMeta { + fn from(value: &ListRootsRequestParamsMeta) -> Self { + value.clone() + } +} +impl ::std::default::Default for ListRootsRequestParamsMeta { + fn default() -> Self { + Self { + progress_token: Default::default(), + } + } +} +impl ListRootsRequestParamsMeta { + pub fn builder() -> builder::ListRootsRequestParamsMeta { + Default::default() + } +} +#[doc = "The client's response to a roots/list request from the server.\nThis result contains an array of Root objects, each representing a root directory\nor file that the server can operate on."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The client's response to a roots/list request from the server.\\nThis result contains an array of Root objects, each representing a root directory\\nor file that the server can operate on.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"roots\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"roots\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Root\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListRootsResult { + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + pub roots: ::std::vec::Vec, +} +impl ::std::convert::From<&ListRootsResult> for ListRootsResult { + fn from(value: &ListRootsResult) -> Self { + value.clone() + } +} +impl ListRootsResult { + pub fn builder() -> builder::ListRootsResult { + Default::default() + } +} +#[doc = "Sent from the client to request a list of tools the server has."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Sent from the client to request a list of tools the server has.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"tools/list\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"cursor\": {"] +#[doc = " \"description\": \"An opaque token representing the current pagination position.\\nIf provided, the server should return results starting after this cursor.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListToolsRequest { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&ListToolsRequest> for ListToolsRequest { + fn from(value: &ListToolsRequest) -> Self { + value.clone() + } +} +impl ListToolsRequest { + pub fn builder() -> builder::ListToolsRequest { + Default::default() + } +} +#[doc = "ListToolsRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"cursor\": {"] +#[doc = " \"description\": \"An opaque token representing the current pagination position.\\nIf provided, the server should return results starting after this cursor.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListToolsRequestParams { + #[doc = "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ::std::convert::From<&ListToolsRequestParams> for ListToolsRequestParams { + fn from(value: &ListToolsRequestParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for ListToolsRequestParams { + fn default() -> Self { + Self { + cursor: Default::default(), + } + } +} +impl ListToolsRequestParams { + pub fn builder() -> builder::ListToolsRequestParams { + Default::default() + } +} +#[doc = "The server's response to a tools/list request from the client."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The server's response to a tools/list request from the client.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"tools\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"nextCursor\": {"] +#[doc = " \"description\": \"An opaque token representing the pagination position after the last returned result.\\nIf present, there may be more results available.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"tools\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Tool\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ListToolsResult { + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + #[doc = "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available."] + #[serde( + rename = "nextCursor", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub next_cursor: ::std::option::Option<::std::string::String>, + pub tools: ::std::vec::Vec, +} +impl ::std::convert::From<&ListToolsResult> for ListToolsResult { + fn from(value: &ListToolsResult) -> Self { + value.clone() + } +} +impl ListToolsResult { + pub fn builder() -> builder::ListToolsResult { + Default::default() + } +} +#[doc = "The severity of a log message.\n\nThese map to syslog message severities, as specified in RFC-5424:\nhttps://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The severity of a log message.\\n\\nThese map to syslog message severities, as specified in RFC-5424:\\nhttps://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"enum\": ["] +#[doc = " \"alert\","] +#[doc = " \"critical\","] +#[doc = " \"debug\","] +#[doc = " \"emergency\","] +#[doc = " \"error\","] +#[doc = " \"info\","] +#[doc = " \"notice\","] +#[doc = " \"warning\""] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive( + :: serde :: Deserialize, + :: serde :: Serialize, + Clone, + Copy, + Debug, + Eq, + Hash, + Ord, + PartialEq, + PartialOrd, +)] +pub enum LoggingLevel { + #[serde(rename = "alert")] + Alert, + #[serde(rename = "critical")] + Critical, + #[serde(rename = "debug")] + Debug, + #[serde(rename = "emergency")] + Emergency, + #[serde(rename = "error")] + Error, + #[serde(rename = "info")] + Info, + #[serde(rename = "notice")] + Notice, + #[serde(rename = "warning")] + Warning, +} +impl ::std::convert::From<&Self> for LoggingLevel { + fn from(value: &LoggingLevel) -> Self { + value.clone() + } +} +impl ::std::fmt::Display for LoggingLevel { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match *self { + Self::Alert => write!(f, "alert"), + Self::Critical => write!(f, "critical"), + Self::Debug => write!(f, "debug"), + Self::Emergency => write!(f, "emergency"), + Self::Error => write!(f, "error"), + Self::Info => write!(f, "info"), + Self::Notice => write!(f, "notice"), + Self::Warning => write!(f, "warning"), + } + } +} +impl ::std::str::FromStr for LoggingLevel { + type Err = self::error::ConversionError; + fn from_str(value: &str) -> ::std::result::Result { + match value { + "alert" => Ok(Self::Alert), + "critical" => Ok(Self::Critical), + "debug" => Ok(Self::Debug), + "emergency" => Ok(Self::Emergency), + "error" => Ok(Self::Error), + "info" => Ok(Self::Info), + "notice" => Ok(Self::Notice), + "warning" => Ok(Self::Warning), + _ => Err("invalid value".into()), + } + } +} +impl ::std::convert::TryFrom<&str> for LoggingLevel { + type Error = self::error::ConversionError; + fn try_from(value: &str) -> ::std::result::Result { + value.parse() + } +} +impl ::std::convert::TryFrom<&::std::string::String> for LoggingLevel { + type Error = self::error::ConversionError; + fn try_from( + value: &::std::string::String, + ) -> ::std::result::Result { + value.parse() + } +} +impl ::std::convert::TryFrom<::std::string::String> for LoggingLevel { + type Error = self::error::ConversionError; + fn try_from( + value: ::std::string::String, + ) -> ::std::result::Result { + value.parse() + } +} +#[doc = "Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"notifications/message\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"data\","] +#[doc = " \"level\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"data\": {"] +#[doc = " \"description\": \"The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.\""] +#[doc = " },"] +#[doc = " \"level\": {"] +#[doc = " \"description\": \"The severity of this log message.\","] +#[doc = " \"$ref\": \"#/definitions/LoggingLevel\""] +#[doc = " },"] +#[doc = " \"logger\": {"] +#[doc = " \"description\": \"An optional name of the logger issuing this message.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct LoggingMessageNotification { + pub method: ::std::string::String, + pub params: LoggingMessageNotificationParams, +} +impl ::std::convert::From<&LoggingMessageNotification> for LoggingMessageNotification { + fn from(value: &LoggingMessageNotification) -> Self { + value.clone() + } +} +impl LoggingMessageNotification { + pub fn builder() -> builder::LoggingMessageNotification { + Default::default() + } +} +#[doc = "LoggingMessageNotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"data\","] +#[doc = " \"level\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"data\": {"] +#[doc = " \"description\": \"The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.\""] +#[doc = " },"] +#[doc = " \"level\": {"] +#[doc = " \"description\": \"The severity of this log message.\","] +#[doc = " \"$ref\": \"#/definitions/LoggingLevel\""] +#[doc = " },"] +#[doc = " \"logger\": {"] +#[doc = " \"description\": \"An optional name of the logger issuing this message.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct LoggingMessageNotificationParams { + #[doc = "The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here."] + pub data: ::serde_json::Value, + #[doc = "The severity of this log message."] + pub level: LoggingLevel, + #[doc = "An optional name of the logger issuing this message."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub logger: ::std::option::Option<::std::string::String>, +} +impl ::std::convert::From<&LoggingMessageNotificationParams> for LoggingMessageNotificationParams { + fn from(value: &LoggingMessageNotificationParams) -> Self { + value.clone() + } +} +impl LoggingMessageNotificationParams { + pub fn builder() -> builder::LoggingMessageNotificationParams { + Default::default() + } +} +#[doc = "Hints to use for model selection.\n\nKeys not declared here are currently left unspecified by the spec and are up\nto the client to interpret."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Hints to use for model selection.\\n\\nKeys not declared here are currently left unspecified by the spec and are up\\nto the client to interpret.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"A hint for a model name.\\n\\nThe client SHOULD treat this as a substring of a model name; for example:\\n - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`\\n - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.\\n - `claude` should match any Claude model\\n\\nThe client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:\\n - `gemini-1.5-flash` could match `claude-3-haiku-20240307`\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ModelHint { + #[doc = "A hint for a model name.\n\nThe client SHOULD treat this as a substring of a model name; for example:\n - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022`\n - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc.\n - `claude` should match any Claude model\n\nThe client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example:\n - `gemini-1.5-flash` could match `claude-3-haiku-20240307`"] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub name: ::std::option::Option<::std::string::String>, +} +impl ::std::convert::From<&ModelHint> for ModelHint { + fn from(value: &ModelHint) -> Self { + value.clone() + } +} +impl ::std::default::Default for ModelHint { + fn default() -> Self { + Self { + name: Default::default(), + } + } +} +impl ModelHint { + pub fn builder() -> builder::ModelHint { + Default::default() + } +} +#[doc = "The server's preferences for model selection, requested of the client during sampling.\n\nBecause LLMs can vary along multiple dimensions, choosing the \"best\" model is\nrarely straightforward. Different models excel in different areas—some are\nfaster but less capable, others are more capable but more expensive, and so\non. This interface allows servers to express their priorities across multiple\ndimensions to help clients make an appropriate selection for their use case.\n\nThese preferences are always advisory. The client MAY ignore them. It is also\nup to the client to decide how to interpret these preferences and how to\nbalance them against other considerations."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The server's preferences for model selection, requested of the client during sampling.\\n\\nBecause LLMs can vary along multiple dimensions, choosing the \\\"best\\\" model is\\nrarely straightforward. Different models excel in different areas—some are\\nfaster but less capable, others are more capable but more expensive, and so\\non. This interface allows servers to express their priorities across multiple\\ndimensions to help clients make an appropriate selection for their use case.\\n\\nThese preferences are always advisory. The client MAY ignore them. It is also\\nup to the client to decide how to interpret these preferences and how to\\nbalance them against other considerations.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"costPriority\": {"] +#[doc = " \"description\": \"How much to prioritize cost when selecting a model. A value of 0 means cost\\nis not important, while a value of 1 means cost is the most important\\nfactor.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " },"] +#[doc = " \"hints\": {"] +#[doc = " \"description\": \"Optional hints to use for model selection.\\n\\nIf multiple hints are specified, the client MUST evaluate them in order\\n(such that the first match is taken).\\n\\nThe client SHOULD prioritize these hints over the numeric priorities, but\\nMAY still use the priorities to select from ambiguous matches.\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/ModelHint\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"intelligencePriority\": {"] +#[doc = " \"description\": \"How much to prioritize intelligence and capabilities when selecting a\\nmodel. A value of 0 means intelligence is not important, while a value of 1\\nmeans intelligence is the most important factor.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " },"] +#[doc = " \"speedPriority\": {"] +#[doc = " \"description\": \"How much to prioritize sampling speed (latency) when selecting a model. A\\nvalue of 0 means speed is not important, while a value of 1 means speed is\\nthe most important factor.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ModelPreferences { + #[serde( + rename = "costPriority", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub cost_priority: ::std::option::Option, + #[doc = "Optional hints to use for model selection.\n\nIf multiple hints are specified, the client MUST evaluate them in order\n(such that the first match is taken).\n\nThe client SHOULD prioritize these hints over the numeric priorities, but\nMAY still use the priorities to select from ambiguous matches."] + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] + pub hints: ::std::vec::Vec, + #[serde( + rename = "intelligencePriority", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub intelligence_priority: ::std::option::Option, + #[serde( + rename = "speedPriority", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub speed_priority: ::std::option::Option, +} +impl ::std::convert::From<&ModelPreferences> for ModelPreferences { + fn from(value: &ModelPreferences) -> Self { + value.clone() + } +} +impl ::std::default::Default for ModelPreferences { + fn default() -> Self { + Self { + cost_priority: Default::default(), + hints: Default::default(), + intelligence_priority: Default::default(), + speed_priority: Default::default(), + } + } +} +impl ModelPreferences { + pub fn builder() -> builder::ModelPreferences { + Default::default() + } +} +#[doc = "Notification"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct Notification { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&Notification> for Notification { + fn from(value: &Notification) -> Self { + value.clone() + } +} +impl Notification { + pub fn builder() -> builder::Notification { + Default::default() + } +} +#[doc = "NotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct NotificationParams { + #[doc = "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&NotificationParams> for NotificationParams { + fn from(value: &NotificationParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for NotificationParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl NotificationParams { + pub fn builder() -> builder::NotificationParams { + Default::default() + } +} +#[doc = "PaginatedRequest"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"cursor\": {"] +#[doc = " \"description\": \"An opaque token representing the current pagination position.\\nIf provided, the server should return results starting after this cursor.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PaginatedRequest { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&PaginatedRequest> for PaginatedRequest { + fn from(value: &PaginatedRequest) -> Self { + value.clone() + } +} +impl PaginatedRequest { + pub fn builder() -> builder::PaginatedRequest { + Default::default() + } +} +#[doc = "PaginatedRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"cursor\": {"] +#[doc = " \"description\": \"An opaque token representing the current pagination position.\\nIf provided, the server should return results starting after this cursor.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PaginatedRequestParams { + #[doc = "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ::std::convert::From<&PaginatedRequestParams> for PaginatedRequestParams { + fn from(value: &PaginatedRequestParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for PaginatedRequestParams { + fn default() -> Self { + Self { + cursor: Default::default(), + } + } +} +impl PaginatedRequestParams { + pub fn builder() -> builder::PaginatedRequestParams { + Default::default() + } +} +#[doc = "PaginatedResult"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"nextCursor\": {"] +#[doc = " \"description\": \"An opaque token representing the pagination position after the last returned result.\\nIf present, there may be more results available.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PaginatedResult { + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + #[doc = "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available."] + #[serde( + rename = "nextCursor", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub next_cursor: ::std::option::Option<::std::string::String>, +} +impl ::std::convert::From<&PaginatedResult> for PaginatedResult { + fn from(value: &PaginatedResult) -> Self { + value.clone() + } +} +impl ::std::default::Default for PaginatedResult { + fn default() -> Self { + Self { + meta: Default::default(), + next_cursor: Default::default(), + } + } +} +impl PaginatedResult { + pub fn builder() -> builder::PaginatedResult { + Default::default() + } +} +#[doc = "A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"ping\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PingRequest { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&PingRequest> for PingRequest { + fn from(value: &PingRequest) -> Self { + value.clone() + } +} +impl PingRequest { + pub fn builder() -> builder::PingRequest { + Default::default() + } +} +#[doc = "PingRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PingRequestParams { + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub meta: ::std::option::Option, +} +impl ::std::convert::From<&PingRequestParams> for PingRequestParams { + fn from(value: &PingRequestParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for PingRequestParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl PingRequestParams { + pub fn builder() -> builder::PingRequestParams { + Default::default() + } +} +#[doc = "PingRequestParamsMeta"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PingRequestParamsMeta { + #[doc = "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications."] + #[serde( + rename = "progressToken", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub progress_token: ::std::option::Option, +} +impl ::std::convert::From<&PingRequestParamsMeta> for PingRequestParamsMeta { + fn from(value: &PingRequestParamsMeta) -> Self { + value.clone() + } +} +impl ::std::default::Default for PingRequestParamsMeta { + fn default() -> Self { + Self { + progress_token: Default::default(), + } + } +} +impl PingRequestParamsMeta { + pub fn builder() -> builder::PingRequestParamsMeta { + Default::default() + } +} +#[doc = "An out-of-band notification used to inform the receiver of a progress update for a long-running request."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"An out-of-band notification used to inform the receiver of a progress update for a long-running request.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"notifications/progress\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"progress\","] +#[doc = " \"progressToken\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"progress\": {"] +#[doc = " \"description\": \"The progress thus far. This should increase every time progress is made, even if the total is unknown.\","] +#[doc = " \"type\": \"number\""] +#[doc = " },"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " },"] +#[doc = " \"total\": {"] +#[doc = " \"description\": \"Total number of items to process (or total progress required), if known.\","] +#[doc = " \"type\": \"number\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ProgressNotification { + pub method: ::std::string::String, + pub params: ProgressNotificationParams, +} +impl ::std::convert::From<&ProgressNotification> for ProgressNotification { + fn from(value: &ProgressNotification) -> Self { + value.clone() + } +} +impl ProgressNotification { + pub fn builder() -> builder::ProgressNotification { + Default::default() + } +} +#[doc = "ProgressNotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"progress\","] +#[doc = " \"progressToken\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"progress\": {"] +#[doc = " \"description\": \"The progress thus far. This should increase every time progress is made, even if the total is unknown.\","] +#[doc = " \"type\": \"number\""] +#[doc = " },"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " },"] +#[doc = " \"total\": {"] +#[doc = " \"description\": \"Total number of items to process (or total progress required), if known.\","] +#[doc = " \"type\": \"number\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ProgressNotificationParams { + pub progress: f64, + #[doc = "The progress token which was given in the initial request, used to associate this notification with the request that is proceeding."] + #[serde(rename = "progressToken")] + pub progress_token: ProgressToken, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub total: ::std::option::Option, +} +impl ::std::convert::From<&ProgressNotificationParams> for ProgressNotificationParams { + fn from(value: &ProgressNotificationParams) -> Self { + value.clone() + } +} +impl ProgressNotificationParams { + pub fn builder() -> builder::ProgressNotificationParams { + Default::default() + } +} +#[doc = "A progress token, used to associate progress notifications with the original request."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A progress token, used to associate progress notifications with the original request.\","] +#[doc = " \"type\": ["] +#[doc = " \"string\","] +#[doc = " \"integer\""] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum ProgressToken { + String(::std::string::String), + Integer(i64), +} +impl ::std::convert::From<&Self> for ProgressToken { + fn from(value: &ProgressToken) -> Self { + value.clone() + } +} +impl ::std::str::FromStr for ProgressToken { + type Err = self::error::ConversionError; + fn from_str(value: &str) -> ::std::result::Result { + if let Ok(v) = value.parse() { + Ok(Self::String(v)) + } else if let Ok(v) = value.parse() { + Ok(Self::Integer(v)) + } else { + Err("string conversion failed for all variants".into()) + } + } +} +impl ::std::convert::TryFrom<&str> for ProgressToken { + type Error = self::error::ConversionError; + fn try_from(value: &str) -> ::std::result::Result { + value.parse() + } +} +impl ::std::convert::TryFrom<&::std::string::String> for ProgressToken { + type Error = self::error::ConversionError; + fn try_from( + value: &::std::string::String, + ) -> ::std::result::Result { + value.parse() + } +} +impl ::std::convert::TryFrom<::std::string::String> for ProgressToken { + type Error = self::error::ConversionError; + fn try_from( + value: ::std::string::String, + ) -> ::std::result::Result { + value.parse() + } +} +impl ::std::fmt::Display for ProgressToken { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::String(x) => x.fmt(f), + Self::Integer(x) => x.fmt(f), + } + } +} +impl ::std::convert::From for ProgressToken { + fn from(value: i64) -> Self { + Self::Integer(value) + } +} +#[doc = "A prompt or prompt template that the server offers."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A prompt or prompt template that the server offers.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"arguments\": {"] +#[doc = " \"description\": \"A list of arguments to use for templating the prompt.\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/PromptArgument\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"description\": {"] +#[doc = " \"description\": \"An optional description of what this prompt provides\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"The name of the prompt or prompt template.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct Prompt { + #[doc = "A list of arguments to use for templating the prompt."] + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] + pub arguments: ::std::vec::Vec, + #[doc = "An optional description of what this prompt provides"] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub description: ::std::option::Option<::std::string::String>, + #[doc = "The name of the prompt or prompt template."] + pub name: ::std::string::String, +} +impl ::std::convert::From<&Prompt> for Prompt { + fn from(value: &Prompt) -> Self { + value.clone() + } +} +impl Prompt { + pub fn builder() -> builder::Prompt { + Default::default() + } +} +#[doc = "Describes an argument that a prompt can accept."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Describes an argument that a prompt can accept.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"description\": {"] +#[doc = " \"description\": \"A human-readable description of the argument.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"The name of the argument.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"required\": {"] +#[doc = " \"description\": \"Whether this argument must be provided.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PromptArgument { + #[doc = "A human-readable description of the argument."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub description: ::std::option::Option<::std::string::String>, + #[doc = "The name of the argument."] + pub name: ::std::string::String, + #[doc = "Whether this argument must be provided."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub required: ::std::option::Option, +} +impl ::std::convert::From<&PromptArgument> for PromptArgument { + fn from(value: &PromptArgument) -> Self { + value.clone() + } +} +impl PromptArgument { + pub fn builder() -> builder::PromptArgument { + Default::default() + } +} +#[doc = "An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"notifications/prompts/list_changed\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PromptListChangedNotification { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&PromptListChangedNotification> for PromptListChangedNotification { + fn from(value: &PromptListChangedNotification) -> Self { + value.clone() + } +} +impl PromptListChangedNotification { + pub fn builder() -> builder::PromptListChangedNotification { + Default::default() + } +} +#[doc = "PromptListChangedNotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PromptListChangedNotificationParams { + #[doc = "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&PromptListChangedNotificationParams> + for PromptListChangedNotificationParams +{ + fn from(value: &PromptListChangedNotificationParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for PromptListChangedNotificationParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl PromptListChangedNotificationParams { + pub fn builder() -> builder::PromptListChangedNotificationParams { + Default::default() + } +} +#[doc = "Describes a message returned as part of a prompt.\n\nThis is similar to `SamplingMessage`, but also supports the embedding of\nresources from the MCP server."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Describes a message returned as part of a prompt.\\n\\nThis is similar to `SamplingMessage`, but also supports the embedding of\\nresources from the MCP server.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"content\","] +#[doc = " \"role\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"content\": {"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ImageContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/EmbeddedResource\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = " },"] +#[doc = " \"role\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PromptMessage { + pub content: PromptMessageContent, + pub role: Role, +} +impl ::std::convert::From<&PromptMessage> for PromptMessage { + fn from(value: &PromptMessage) -> Self { + value.clone() + } +} +impl PromptMessage { + pub fn builder() -> builder::PromptMessage { + Default::default() + } +} +#[doc = "PromptMessageContent"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ImageContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/EmbeddedResource\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum PromptMessageContent { + TextContent(TextContent), + ImageContent(ImageContent), + EmbeddedResource(EmbeddedResource), +} +impl ::std::convert::From<&Self> for PromptMessageContent { + fn from(value: &PromptMessageContent) -> Self { + value.clone() + } +} +impl ::std::convert::From for PromptMessageContent { + fn from(value: TextContent) -> Self { + Self::TextContent(value) + } +} +impl ::std::convert::From for PromptMessageContent { + fn from(value: ImageContent) -> Self { + Self::ImageContent(value) + } +} +impl ::std::convert::From for PromptMessageContent { + fn from(value: EmbeddedResource) -> Self { + Self::EmbeddedResource(value) + } +} +#[doc = "Identifies a prompt."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Identifies a prompt.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\","] +#[doc = " \"type\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"The name of the prompt or prompt template\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"type\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"ref/prompt\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct PromptReference { + #[doc = "The name of the prompt or prompt template"] + pub name: ::std::string::String, + #[serde(rename = "type")] + pub type_: ::std::string::String, +} +impl ::std::convert::From<&PromptReference> for PromptReference { + fn from(value: &PromptReference) -> Self { + value.clone() + } +} +impl PromptReference { + pub fn builder() -> builder::PromptReference { + Default::default() + } +} +#[doc = "Sent from the client to the server, to read a specific resource URI."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Sent from the client to the server, to read a specific resource URI.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"resources/read\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ReadResourceRequest { + pub method: ::std::string::String, + pub params: ReadResourceRequestParams, +} +impl ::std::convert::From<&ReadResourceRequest> for ReadResourceRequest { + fn from(value: &ReadResourceRequest) -> Self { + value.clone() + } +} +impl ReadResourceRequest { + pub fn builder() -> builder::ReadResourceRequest { + Default::default() + } +} +#[doc = "ReadResourceRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ReadResourceRequestParams { + #[doc = "The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it."] + pub uri: ::std::string::String, +} +impl ::std::convert::From<&ReadResourceRequestParams> for ReadResourceRequestParams { + fn from(value: &ReadResourceRequestParams) -> Self { + value.clone() + } +} +impl ReadResourceRequestParams { + pub fn builder() -> builder::ReadResourceRequestParams { + Default::default() + } +} +#[doc = "The server's response to a resources/read request from the client."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The server's response to a resources/read request from the client.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"contents\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " },"] +#[doc = " \"contents\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextResourceContents\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/BlobResourceContents\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ReadResourceResult { + pub contents: ::std::vec::Vec, + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&ReadResourceResult> for ReadResourceResult { + fn from(value: &ReadResourceResult) -> Self { + value.clone() + } +} +impl ReadResourceResult { + pub fn builder() -> builder::ReadResourceResult { + Default::default() + } +} +#[doc = "ReadResourceResultContentsItem"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextResourceContents\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/BlobResourceContents\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum ReadResourceResultContentsItem { + TextResourceContents(TextResourceContents), + BlobResourceContents(BlobResourceContents), +} +impl ::std::convert::From<&Self> for ReadResourceResultContentsItem { + fn from(value: &ReadResourceResultContentsItem) -> Self { + value.clone() + } +} +impl ::std::convert::From for ReadResourceResultContentsItem { + fn from(value: TextResourceContents) -> Self { + Self::TextResourceContents(value) + } +} +impl ::std::convert::From for ReadResourceResultContentsItem { + fn from(value: BlobResourceContents) -> Self { + Self::BlobResourceContents(value) + } +} +#[doc = "Request"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct Request { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&Request> for Request { + fn from(value: &Request) -> Self { + value.clone() + } +} +impl Request { + pub fn builder() -> builder::Request { + Default::default() + } +} +#[doc = "A uniquely identifying ID for a request in JSON-RPC."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A uniquely identifying ID for a request in JSON-RPC.\","] +#[doc = " \"type\": ["] +#[doc = " \"string\","] +#[doc = " \"integer\""] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum RequestId { + String(::std::string::String), + Integer(i64), +} +impl ::std::convert::From<&Self> for RequestId { + fn from(value: &RequestId) -> Self { + value.clone() + } +} +impl ::std::str::FromStr for RequestId { + type Err = self::error::ConversionError; + fn from_str(value: &str) -> ::std::result::Result { + if let Ok(v) = value.parse() { + Ok(Self::String(v)) + } else if let Ok(v) = value.parse() { + Ok(Self::Integer(v)) + } else { + Err("string conversion failed for all variants".into()) + } + } +} +impl ::std::convert::TryFrom<&str> for RequestId { + type Error = self::error::ConversionError; + fn try_from(value: &str) -> ::std::result::Result { + value.parse() + } +} +impl ::std::convert::TryFrom<&::std::string::String> for RequestId { + type Error = self::error::ConversionError; + fn try_from( + value: &::std::string::String, + ) -> ::std::result::Result { + value.parse() + } +} +impl ::std::convert::TryFrom<::std::string::String> for RequestId { + type Error = self::error::ConversionError; + fn try_from( + value: ::std::string::String, + ) -> ::std::result::Result { + value.parse() + } +} +impl ::std::fmt::Display for RequestId { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::String(x) => x.fmt(f), + Self::Integer(x) => x.fmt(f), + } + } +} +impl ::std::convert::From for RequestId { + fn from(value: i64) -> Self { + Self::Integer(value) + } +} +#[doc = "RequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct RequestParams { + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub meta: ::std::option::Option, +} +impl ::std::convert::From<&RequestParams> for RequestParams { + fn from(value: &RequestParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for RequestParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl RequestParams { + pub fn builder() -> builder::RequestParams { + Default::default() + } +} +#[doc = "RequestParamsMeta"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"progressToken\": {"] +#[doc = " \"description\": \"If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.\","] +#[doc = " \"$ref\": \"#/definitions/ProgressToken\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct RequestParamsMeta { + #[doc = "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications."] + #[serde( + rename = "progressToken", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub progress_token: ::std::option::Option, +} +impl ::std::convert::From<&RequestParamsMeta> for RequestParamsMeta { + fn from(value: &RequestParamsMeta) -> Self { + value.clone() + } +} +impl ::std::default::Default for RequestParamsMeta { + fn default() -> Self { + Self { + progress_token: Default::default(), + } + } +} +impl RequestParamsMeta { + pub fn builder() -> builder::RequestParamsMeta { + Default::default() + } +} +#[doc = "A known resource that the server is capable of reading."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A known resource that the server is capable of reading.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\","] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"annotations\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"description\": {"] +#[doc = " \"description\": \"A description of what this resource represents.\\n\\nThis can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \\\"hint\\\" to the model.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"mimeType\": {"] +#[doc = " \"description\": \"The MIME type of this resource, if known.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"A human-readable name for this resource.\\n\\nThis can be used by clients to populate UI elements.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"size\": {"] +#[doc = " \"description\": \"The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\\n\\nThis can be used by Hosts to display file sizes and estimate context window usage.\","] +#[doc = " \"type\": \"integer\""] +#[doc = " },"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of this resource.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct Resource { + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub annotations: ::std::option::Option, + #[doc = "A description of what this resource represents.\n\nThis can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub description: ::std::option::Option<::std::string::String>, + #[doc = "The MIME type of this resource, if known."] + #[serde( + rename = "mimeType", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub mime_type: ::std::option::Option<::std::string::String>, + #[doc = "A human-readable name for this resource.\n\nThis can be used by clients to populate UI elements."] + pub name: ::std::string::String, + #[doc = "The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.\n\nThis can be used by Hosts to display file sizes and estimate context window usage."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub size: ::std::option::Option, + #[doc = "The URI of this resource."] + pub uri: ::std::string::String, +} +impl ::std::convert::From<&Resource> for Resource { + fn from(value: &Resource) -> Self { + value.clone() + } +} +impl Resource { + pub fn builder() -> builder::Resource { + Default::default() + } +} +#[doc = "ResourceAnnotations"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ResourceAnnotations { + #[doc = "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`)."] + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] + pub audience: ::std::vec::Vec, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub priority: ::std::option::Option, +} +impl ::std::convert::From<&ResourceAnnotations> for ResourceAnnotations { + fn from(value: &ResourceAnnotations) -> Self { + value.clone() + } +} +impl ::std::default::Default for ResourceAnnotations { + fn default() -> Self { + Self { + audience: Default::default(), + priority: Default::default(), + } + } +} +impl ResourceAnnotations { + pub fn builder() -> builder::ResourceAnnotations { + Default::default() + } +} +#[doc = "The contents of a specific resource or sub-resource."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The contents of a specific resource or sub-resource.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"mimeType\": {"] +#[doc = " \"description\": \"The MIME type of this resource, if known.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of this resource.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ResourceContents { + #[doc = "The MIME type of this resource, if known."] + #[serde( + rename = "mimeType", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub mime_type: ::std::option::Option<::std::string::String>, + #[doc = "The URI of this resource."] + pub uri: ::std::string::String, +} +impl ::std::convert::From<&ResourceContents> for ResourceContents { + fn from(value: &ResourceContents) -> Self { + value.clone() + } +} +impl ResourceContents { + pub fn builder() -> builder::ResourceContents { + Default::default() + } +} +#[doc = "An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"notifications/resources/list_changed\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ResourceListChangedNotification { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&ResourceListChangedNotification> for ResourceListChangedNotification { + fn from(value: &ResourceListChangedNotification) -> Self { + value.clone() + } +} +impl ResourceListChangedNotification { + pub fn builder() -> builder::ResourceListChangedNotification { + Default::default() + } +} +#[doc = "ResourceListChangedNotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ResourceListChangedNotificationParams { + #[doc = "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&ResourceListChangedNotificationParams> + for ResourceListChangedNotificationParams +{ + fn from(value: &ResourceListChangedNotificationParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for ResourceListChangedNotificationParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl ResourceListChangedNotificationParams { + pub fn builder() -> builder::ResourceListChangedNotificationParams { + Default::default() + } +} +#[doc = "A reference to a resource or resource template definition."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A reference to a resource or resource template definition.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"type\","] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"type\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"ref/resource\""] +#[doc = " },"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI or URI template of the resource.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri-template\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ResourceReference { + #[serde(rename = "type")] + pub type_: ::std::string::String, + #[doc = "The URI or URI template of the resource."] + pub uri: ::std::string::String, +} +impl ::std::convert::From<&ResourceReference> for ResourceReference { + fn from(value: &ResourceReference) -> Self { + value.clone() + } +} +impl ResourceReference { + pub fn builder() -> builder::ResourceReference { + Default::default() + } +} +#[doc = "A template description for resources available on the server."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A template description for resources available on the server.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"name\","] +#[doc = " \"uriTemplate\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"annotations\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"description\": {"] +#[doc = " \"description\": \"A description of what this template is for.\\n\\nThis can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \\\"hint\\\" to the model.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"mimeType\": {"] +#[doc = " \"description\": \"The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"A human-readable name for the type of resource this template refers to.\\n\\nThis can be used by clients to populate UI elements.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"uriTemplate\": {"] +#[doc = " \"description\": \"A URI template (according to RFC 6570) that can be used to construct resource URIs.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri-template\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ResourceTemplate { + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub annotations: ::std::option::Option, + #[doc = "A description of what this template is for.\n\nThis can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub description: ::std::option::Option<::std::string::String>, + #[doc = "The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type."] + #[serde( + rename = "mimeType", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub mime_type: ::std::option::Option<::std::string::String>, + #[doc = "A human-readable name for the type of resource this template refers to.\n\nThis can be used by clients to populate UI elements."] + pub name: ::std::string::String, + #[doc = "A URI template (according to RFC 6570) that can be used to construct resource URIs."] + #[serde(rename = "uriTemplate")] + pub uri_template: ::std::string::String, +} +impl ::std::convert::From<&ResourceTemplate> for ResourceTemplate { + fn from(value: &ResourceTemplate) -> Self { + value.clone() + } +} +impl ResourceTemplate { + pub fn builder() -> builder::ResourceTemplate { + Default::default() + } +} +#[doc = "ResourceTemplateAnnotations"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ResourceTemplateAnnotations { + #[doc = "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`)."] + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] + pub audience: ::std::vec::Vec, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub priority: ::std::option::Option, +} +impl ::std::convert::From<&ResourceTemplateAnnotations> for ResourceTemplateAnnotations { + fn from(value: &ResourceTemplateAnnotations) -> Self { + value.clone() + } +} +impl ::std::default::Default for ResourceTemplateAnnotations { + fn default() -> Self { + Self { + audience: Default::default(), + priority: Default::default(), + } + } +} +impl ResourceTemplateAnnotations { + pub fn builder() -> builder::ResourceTemplateAnnotations { + Default::default() + } +} +#[doc = "A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"notifications/resources/updated\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ResourceUpdatedNotification { + pub method: ::std::string::String, + pub params: ResourceUpdatedNotificationParams, +} +impl ::std::convert::From<&ResourceUpdatedNotification> for ResourceUpdatedNotification { + fn from(value: &ResourceUpdatedNotification) -> Self { + value.clone() + } +} +impl ResourceUpdatedNotification { + pub fn builder() -> builder::ResourceUpdatedNotification { + Default::default() + } +} +#[doc = "ResourceUpdatedNotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ResourceUpdatedNotificationParams { + #[doc = "The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to."] + pub uri: ::std::string::String, +} +impl ::std::convert::From<&ResourceUpdatedNotificationParams> + for ResourceUpdatedNotificationParams +{ + fn from(value: &ResourceUpdatedNotificationParams) -> Self { + value.clone() + } +} +impl ResourceUpdatedNotificationParams { + pub fn builder() -> builder::ResourceUpdatedNotificationParams { + Default::default() + } +} +#[doc = "Result"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct Result { + #[doc = "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&Result> for Result { + fn from(value: &Result) -> Self { + value.clone() + } +} +impl ::std::default::Default for Result { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl Result { + pub fn builder() -> builder::Result { + Default::default() + } +} +#[doc = "The sender or recipient of messages and data in a conversation."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"The sender or recipient of messages and data in a conversation.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"enum\": ["] +#[doc = " \"assistant\","] +#[doc = " \"user\""] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive( + :: serde :: Deserialize, + :: serde :: Serialize, + Clone, + Copy, + Debug, + Eq, + Hash, + Ord, + PartialEq, + PartialOrd, +)] +pub enum Role { + #[serde(rename = "assistant")] + Assistant, + #[serde(rename = "user")] + User, +} +impl ::std::convert::From<&Self> for Role { + fn from(value: &Role) -> Self { + value.clone() + } +} +impl ::std::fmt::Display for Role { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match *self { + Self::Assistant => write!(f, "assistant"), + Self::User => write!(f, "user"), + } + } +} +impl ::std::str::FromStr for Role { + type Err = self::error::ConversionError; + fn from_str(value: &str) -> ::std::result::Result { + match value { + "assistant" => Ok(Self::Assistant), + "user" => Ok(Self::User), + _ => Err("invalid value".into()), + } + } +} +impl ::std::convert::TryFrom<&str> for Role { + type Error = self::error::ConversionError; + fn try_from(value: &str) -> ::std::result::Result { + value.parse() + } +} +impl ::std::convert::TryFrom<&::std::string::String> for Role { + type Error = self::error::ConversionError; + fn try_from( + value: &::std::string::String, + ) -> ::std::result::Result { + value.parse() + } +} +impl ::std::convert::TryFrom<::std::string::String> for Role { + type Error = self::error::ConversionError; + fn try_from( + value: ::std::string::String, + ) -> ::std::result::Result { + value.parse() + } +} +#[doc = "Represents a root directory or file that the server can operate on."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Represents a root directory or file that the server can operate on.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"An optional name for the root. This can be used to provide a human-readable\\nidentifier for the root, which may be useful for display purposes or for\\nreferencing the root in other parts of the application.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI identifying the root. This *must* start with file:// for now.\\nThis restriction may be relaxed in future versions of the protocol to allow\\nother URI schemes.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct Root { + #[doc = "An optional name for the root. This can be used to provide a human-readable\nidentifier for the root, which may be useful for display purposes or for\nreferencing the root in other parts of the application."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub name: ::std::option::Option<::std::string::String>, + #[doc = "The URI identifying the root. This *must* start with file:// for now.\nThis restriction may be relaxed in future versions of the protocol to allow\nother URI schemes."] + pub uri: ::std::string::String, +} +impl ::std::convert::From<&Root> for Root { + fn from(value: &Root) -> Self { + value.clone() + } +} +impl Root { + pub fn builder() -> builder::Root { + Default::default() + } +} +#[doc = "A notification from the client to the server, informing it that the list of roots has changed.\nThis notification should be sent whenever the client adds, removes, or modifies any root.\nThe server should then request an updated list of roots using the ListRootsRequest."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A notification from the client to the server, informing it that the list of roots has changed.\\nThis notification should be sent whenever the client adds, removes, or modifies any root.\\nThe server should then request an updated list of roots using the ListRootsRequest.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"notifications/roots/list_changed\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct RootsListChangedNotification { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&RootsListChangedNotification> for RootsListChangedNotification { + fn from(value: &RootsListChangedNotification) -> Self { + value.clone() + } +} +impl RootsListChangedNotification { + pub fn builder() -> builder::RootsListChangedNotification { + Default::default() + } +} +#[doc = "RootsListChangedNotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct RootsListChangedNotificationParams { + #[doc = "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&RootsListChangedNotificationParams> + for RootsListChangedNotificationParams +{ + fn from(value: &RootsListChangedNotificationParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for RootsListChangedNotificationParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl RootsListChangedNotificationParams { + pub fn builder() -> builder::RootsListChangedNotificationParams { + Default::default() + } +} +#[doc = "Describes a message issued to or received from an LLM API."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Describes a message issued to or received from an LLM API.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"content\","] +#[doc = " \"role\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"content\": {"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ImageContent\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = " },"] +#[doc = " \"role\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct SamplingMessage { + pub content: SamplingMessageContent, + pub role: Role, +} +impl ::std::convert::From<&SamplingMessage> for SamplingMessage { + fn from(value: &SamplingMessage) -> Self { + value.clone() + } +} +impl SamplingMessage { + pub fn builder() -> builder::SamplingMessage { + Default::default() + } +} +#[doc = "SamplingMessageContent"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/TextContent\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ImageContent\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum SamplingMessageContent { + TextContent(TextContent), + ImageContent(ImageContent), +} +impl ::std::convert::From<&Self> for SamplingMessageContent { + fn from(value: &SamplingMessageContent) -> Self { + value.clone() + } +} +impl ::std::convert::From for SamplingMessageContent { + fn from(value: TextContent) -> Self { + Self::TextContent(value) + } +} +impl ::std::convert::From for SamplingMessageContent { + fn from(value: ImageContent) -> Self { + Self::ImageContent(value) + } +} +#[doc = "Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"experimental\": {"] +#[doc = " \"description\": \"Experimental, non-standard capabilities that the server supports.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": true"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"logging\": {"] +#[doc = " \"description\": \"Present if the server supports sending log messages to the client.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": true"] +#[doc = " },"] +#[doc = " \"prompts\": {"] +#[doc = " \"description\": \"Present if the server offers any prompt templates.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"listChanged\": {"] +#[doc = " \"description\": \"Whether this server supports notifications for changes to the prompt list.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"resources\": {"] +#[doc = " \"description\": \"Present if the server offers any resources to read.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"listChanged\": {"] +#[doc = " \"description\": \"Whether this server supports notifications for changes to the resource list.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " },"] +#[doc = " \"subscribe\": {"] +#[doc = " \"description\": \"Whether this server supports subscribing to resource updates.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"tools\": {"] +#[doc = " \"description\": \"Present if the server offers any tools to call.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"listChanged\": {"] +#[doc = " \"description\": \"Whether this server supports notifications for changes to the tool list.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ServerCapabilities { + #[doc = "Experimental, non-standard capabilities that the server supports."] + #[serde( + default, + skip_serializing_if = ":: std :: collections :: HashMap::is_empty" + )] + pub experimental: ::std::collections::HashMap< + ::std::string::String, + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + #[doc = "Present if the server supports sending log messages to the client."] + #[serde(default, skip_serializing_if = "::serde_json::Map::is_empty")] + pub logging: ::serde_json::Map<::std::string::String, ::serde_json::Value>, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub prompts: ::std::option::Option, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub resources: ::std::option::Option, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub tools: ::std::option::Option, +} +impl ::std::convert::From<&ServerCapabilities> for ServerCapabilities { + fn from(value: &ServerCapabilities) -> Self { + value.clone() + } +} +impl ::std::default::Default for ServerCapabilities { + fn default() -> Self { + Self { + experimental: Default::default(), + logging: Default::default(), + prompts: Default::default(), + resources: Default::default(), + tools: Default::default(), + } + } +} +impl ServerCapabilities { + pub fn builder() -> builder::ServerCapabilities { + Default::default() + } +} +#[doc = "Present if the server offers any prompt templates."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Present if the server offers any prompt templates.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"listChanged\": {"] +#[doc = " \"description\": \"Whether this server supports notifications for changes to the prompt list.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ServerCapabilitiesPrompts { + #[doc = "Whether this server supports notifications for changes to the prompt list."] + #[serde( + rename = "listChanged", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub list_changed: ::std::option::Option, +} +impl ::std::convert::From<&ServerCapabilitiesPrompts> for ServerCapabilitiesPrompts { + fn from(value: &ServerCapabilitiesPrompts) -> Self { + value.clone() + } +} +impl ::std::default::Default for ServerCapabilitiesPrompts { + fn default() -> Self { + Self { + list_changed: Default::default(), + } + } +} +impl ServerCapabilitiesPrompts { + pub fn builder() -> builder::ServerCapabilitiesPrompts { + Default::default() + } +} +#[doc = "Present if the server offers any resources to read."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Present if the server offers any resources to read.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"listChanged\": {"] +#[doc = " \"description\": \"Whether this server supports notifications for changes to the resource list.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " },"] +#[doc = " \"subscribe\": {"] +#[doc = " \"description\": \"Whether this server supports subscribing to resource updates.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ServerCapabilitiesResources { + #[doc = "Whether this server supports notifications for changes to the resource list."] + #[serde( + rename = "listChanged", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub list_changed: ::std::option::Option, + #[doc = "Whether this server supports subscribing to resource updates."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub subscribe: ::std::option::Option, +} +impl ::std::convert::From<&ServerCapabilitiesResources> for ServerCapabilitiesResources { + fn from(value: &ServerCapabilitiesResources) -> Self { + value.clone() + } +} +impl ::std::default::Default for ServerCapabilitiesResources { + fn default() -> Self { + Self { + list_changed: Default::default(), + subscribe: Default::default(), + } + } +} +impl ServerCapabilitiesResources { + pub fn builder() -> builder::ServerCapabilitiesResources { + Default::default() + } +} +#[doc = "Present if the server offers any tools to call."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Present if the server offers any tools to call.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"listChanged\": {"] +#[doc = " \"description\": \"Whether this server supports notifications for changes to the tool list.\","] +#[doc = " \"type\": \"boolean\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ServerCapabilitiesTools { + #[doc = "Whether this server supports notifications for changes to the tool list."] + #[serde( + rename = "listChanged", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub list_changed: ::std::option::Option, +} +impl ::std::convert::From<&ServerCapabilitiesTools> for ServerCapabilitiesTools { + fn from(value: &ServerCapabilitiesTools) -> Self { + value.clone() + } +} +impl ::std::default::Default for ServerCapabilitiesTools { + fn default() -> Self { + Self { + list_changed: Default::default(), + } + } +} +impl ServerCapabilitiesTools { + pub fn builder() -> builder::ServerCapabilitiesTools { + Default::default() + } +} +#[doc = "ServerNotification"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/CancelledNotification\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ProgressNotification\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ResourceListChangedNotification\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ResourceUpdatedNotification\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/PromptListChangedNotification\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ToolListChangedNotification\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/LoggingMessageNotification\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum ServerNotification { + CancelledNotification(CancelledNotification), + ProgressNotification(ProgressNotification), + ResourceListChangedNotification(ResourceListChangedNotification), + ResourceUpdatedNotification(ResourceUpdatedNotification), + PromptListChangedNotification(PromptListChangedNotification), + ToolListChangedNotification(ToolListChangedNotification), + LoggingMessageNotification(LoggingMessageNotification), +} +impl ::std::convert::From<&Self> for ServerNotification { + fn from(value: &ServerNotification) -> Self { + value.clone() + } +} +impl ::std::convert::From for ServerNotification { + fn from(value: CancelledNotification) -> Self { + Self::CancelledNotification(value) + } +} +impl ::std::convert::From for ServerNotification { + fn from(value: ProgressNotification) -> Self { + Self::ProgressNotification(value) + } +} +impl ::std::convert::From for ServerNotification { + fn from(value: ResourceListChangedNotification) -> Self { + Self::ResourceListChangedNotification(value) + } +} +impl ::std::convert::From for ServerNotification { + fn from(value: ResourceUpdatedNotification) -> Self { + Self::ResourceUpdatedNotification(value) + } +} +impl ::std::convert::From for ServerNotification { + fn from(value: PromptListChangedNotification) -> Self { + Self::PromptListChangedNotification(value) + } +} +impl ::std::convert::From for ServerNotification { + fn from(value: ToolListChangedNotification) -> Self { + Self::ToolListChangedNotification(value) + } +} +impl ::std::convert::From for ServerNotification { + fn from(value: LoggingMessageNotification) -> Self { + Self::LoggingMessageNotification(value) + } +} +#[doc = "ServerRequest"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/PingRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/CreateMessageRequest\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ListRootsRequest\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum ServerRequest { + PingRequest(PingRequest), + CreateMessageRequest(CreateMessageRequest), + ListRootsRequest(ListRootsRequest), +} +impl ::std::convert::From<&Self> for ServerRequest { + fn from(value: &ServerRequest) -> Self { + value.clone() + } +} +impl ::std::convert::From for ServerRequest { + fn from(value: PingRequest) -> Self { + Self::PingRequest(value) + } +} +impl ::std::convert::From for ServerRequest { + fn from(value: CreateMessageRequest) -> Self { + Self::CreateMessageRequest(value) + } +} +impl ::std::convert::From for ServerRequest { + fn from(value: ListRootsRequest) -> Self { + Self::ListRootsRequest(value) + } +} +#[doc = "ServerResult"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"anyOf\": ["] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/Result\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/InitializeResult\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ListResourcesResult\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ListResourceTemplatesResult\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ReadResourceResult\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ListPromptsResult\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/GetPromptResult\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/ListToolsResult\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/CallToolResult\""] +#[doc = " },"] +#[doc = " {"] +#[doc = " \"$ref\": \"#/definitions/CompleteResult\""] +#[doc = " }"] +#[doc = " ]"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +#[serde(untagged)] +pub enum ServerResult { + Result(Result), + InitializeResult(InitializeResult), + ListResourcesResult(ListResourcesResult), + ListResourceTemplatesResult(ListResourceTemplatesResult), + ReadResourceResult(ReadResourceResult), + ListPromptsResult(ListPromptsResult), + GetPromptResult(GetPromptResult), + ListToolsResult(ListToolsResult), + CallToolResult(CallToolResult), + CompleteResult(CompleteResult), +} +impl ::std::convert::From<&Self> for ServerResult { + fn from(value: &ServerResult) -> Self { + value.clone() + } +} +impl ::std::convert::From for ServerResult { + fn from(value: Result) -> Self { + Self::Result(value) + } +} +impl ::std::convert::From for ServerResult { + fn from(value: InitializeResult) -> Self { + Self::InitializeResult(value) + } +} +impl ::std::convert::From for ServerResult { + fn from(value: ListResourcesResult) -> Self { + Self::ListResourcesResult(value) + } +} +impl ::std::convert::From for ServerResult { + fn from(value: ListResourceTemplatesResult) -> Self { + Self::ListResourceTemplatesResult(value) + } +} +impl ::std::convert::From for ServerResult { + fn from(value: ReadResourceResult) -> Self { + Self::ReadResourceResult(value) + } +} +impl ::std::convert::From for ServerResult { + fn from(value: ListPromptsResult) -> Self { + Self::ListPromptsResult(value) + } +} +impl ::std::convert::From for ServerResult { + fn from(value: GetPromptResult) -> Self { + Self::GetPromptResult(value) + } +} +impl ::std::convert::From for ServerResult { + fn from(value: ListToolsResult) -> Self { + Self::ListToolsResult(value) + } +} +impl ::std::convert::From for ServerResult { + fn from(value: CallToolResult) -> Self { + Self::CallToolResult(value) + } +} +impl ::std::convert::From for ServerResult { + fn from(value: CompleteResult) -> Self { + Self::CompleteResult(value) + } +} +#[doc = "A request from the client to the server, to enable or adjust logging."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A request from the client to the server, to enable or adjust logging.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"logging/setLevel\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"level\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"level\": {"] +#[doc = " \"description\": \"The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.\","] +#[doc = " \"$ref\": \"#/definitions/LoggingLevel\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct SetLevelRequest { + pub method: ::std::string::String, + pub params: SetLevelRequestParams, +} +impl ::std::convert::From<&SetLevelRequest> for SetLevelRequest { + fn from(value: &SetLevelRequest) -> Self { + value.clone() + } +} +impl SetLevelRequest { + pub fn builder() -> builder::SetLevelRequest { + Default::default() + } +} +#[doc = "SetLevelRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"level\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"level\": {"] +#[doc = " \"description\": \"The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.\","] +#[doc = " \"$ref\": \"#/definitions/LoggingLevel\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct SetLevelRequestParams { + #[doc = "The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message."] + pub level: LoggingLevel, +} +impl ::std::convert::From<&SetLevelRequestParams> for SetLevelRequestParams { + fn from(value: &SetLevelRequestParams) -> Self { + value.clone() + } +} +impl SetLevelRequestParams { + pub fn builder() -> builder::SetLevelRequestParams { + Default::default() + } +} +#[doc = "Sent from the client to request resources/updated notifications from the server whenever a particular resource changes."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"resources/subscribe\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct SubscribeRequest { + pub method: ::std::string::String, + pub params: SubscribeRequestParams, +} +impl ::std::convert::From<&SubscribeRequest> for SubscribeRequest { + fn from(value: &SubscribeRequest) -> Self { + value.clone() + } +} +impl SubscribeRequest { + pub fn builder() -> builder::SubscribeRequest { + Default::default() + } +} +#[doc = "SubscribeRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct SubscribeRequestParams { + #[doc = "The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it."] + pub uri: ::std::string::String, +} +impl ::std::convert::From<&SubscribeRequestParams> for SubscribeRequestParams { + fn from(value: &SubscribeRequestParams) -> Self { + value.clone() + } +} +impl SubscribeRequestParams { + pub fn builder() -> builder::SubscribeRequestParams { + Default::default() + } +} +#[doc = "Text provided to or from an LLM."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Text provided to or from an LLM.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"text\","] +#[doc = " \"type\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"annotations\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"text\": {"] +#[doc = " \"description\": \"The text content of the message.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"type\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"text\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct TextContent { + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub annotations: ::std::option::Option, + #[doc = "The text content of the message."] + pub text: ::std::string::String, + #[serde(rename = "type")] + pub type_: ::std::string::String, +} +impl ::std::convert::From<&TextContent> for TextContent { + fn from(value: &TextContent) -> Self { + value.clone() + } +} +impl TextContent { + pub fn builder() -> builder::TextContent { + Default::default() + } +} +#[doc = "TextContentAnnotations"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"audience\": {"] +#[doc = " \"description\": \"Describes who the intended customer of this object or data is.\\n\\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\\\"user\\\", \\\"assistant\\\"]`).\","] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"$ref\": \"#/definitions/Role\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"priority\": {"] +#[doc = " \"description\": \"Describes how important this data is for operating the server.\\n\\nA value of 1 means \\\"most important,\\\" and indicates that the data is\\neffectively required, while 0 means \\\"least important,\\\" and indicates that\\nthe data is entirely optional.\","] +#[doc = " \"type\": \"number\","] +#[doc = " \"maximum\": 1.0,"] +#[doc = " \"minimum\": 0.0"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct TextContentAnnotations { + #[doc = "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., `[\"user\", \"assistant\"]`)."] + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] + pub audience: ::std::vec::Vec, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub priority: ::std::option::Option, +} +impl ::std::convert::From<&TextContentAnnotations> for TextContentAnnotations { + fn from(value: &TextContentAnnotations) -> Self { + value.clone() + } +} +impl ::std::default::Default for TextContentAnnotations { + fn default() -> Self { + Self { + audience: Default::default(), + priority: Default::default(), + } + } +} +impl TextContentAnnotations { + pub fn builder() -> builder::TextContentAnnotations { + Default::default() + } +} +#[doc = "TextResourceContents"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"text\","] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"mimeType\": {"] +#[doc = " \"description\": \"The MIME type of this resource, if known.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"text\": {"] +#[doc = " \"description\": \"The text of the item. This must only be set if the item can actually be represented as text (not binary data).\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of this resource.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct TextResourceContents { + #[doc = "The MIME type of this resource, if known."] + #[serde( + rename = "mimeType", + default, + skip_serializing_if = "::std::option::Option::is_none" + )] + pub mime_type: ::std::option::Option<::std::string::String>, + #[doc = "The text of the item. This must only be set if the item can actually be represented as text (not binary data)."] + pub text: ::std::string::String, + #[doc = "The URI of this resource."] + pub uri: ::std::string::String, +} +impl ::std::convert::From<&TextResourceContents> for TextResourceContents { + fn from(value: &TextResourceContents) -> Self { + value.clone() + } +} +impl TextResourceContents { + pub fn builder() -> builder::TextResourceContents { + Default::default() + } +} +#[doc = "Definition for a tool the client can call."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Definition for a tool the client can call.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"inputSchema\","] +#[doc = " \"name\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"description\": {"] +#[doc = " \"description\": \"A human-readable description of the tool.\","] +#[doc = " \"type\": \"string\""] +#[doc = " },"] +#[doc = " \"inputSchema\": {"] +#[doc = " \"description\": \"A JSON Schema object defining the expected parameters for the tool.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"type\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"properties\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": true"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"required\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"type\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"object\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"name\": {"] +#[doc = " \"description\": \"The name of the tool.\","] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct Tool { + #[doc = "A human-readable description of the tool."] + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub description: ::std::option::Option<::std::string::String>, + #[serde(rename = "inputSchema")] + pub input_schema: ToolInputSchema, + #[doc = "The name of the tool."] + pub name: ::std::string::String, +} +impl ::std::convert::From<&Tool> for Tool { + fn from(value: &Tool) -> Self { + value.clone() + } +} +impl Tool { + pub fn builder() -> builder::Tool { + Default::default() + } +} +#[doc = "A JSON Schema object defining the expected parameters for the tool."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"A JSON Schema object defining the expected parameters for the tool.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"type\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"properties\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": true"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"required\": {"] +#[doc = " \"type\": \"array\","] +#[doc = " \"items\": {"] +#[doc = " \"type\": \"string\""] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"type\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"object\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ToolInputSchema { + #[serde( + default, + skip_serializing_if = ":: std :: collections :: HashMap::is_empty" + )] + pub properties: ::std::collections::HashMap< + ::std::string::String, + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")] + pub required: ::std::vec::Vec<::std::string::String>, + #[serde(rename = "type")] + pub type_: ::std::string::String, +} +impl ::std::convert::From<&ToolInputSchema> for ToolInputSchema { + fn from(value: &ToolInputSchema) -> Self { + value.clone() + } +} +impl ToolInputSchema { + pub fn builder() -> builder::ToolInputSchema { + Default::default() + } +} +#[doc = "An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"notifications/tools/list_changed\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ToolListChangedNotification { + pub method: ::std::string::String, + #[serde(default, skip_serializing_if = "::std::option::Option::is_none")] + pub params: ::std::option::Option, +} +impl ::std::convert::From<&ToolListChangedNotification> for ToolListChangedNotification { + fn from(value: &ToolListChangedNotification) -> Self { + value.clone() + } +} +impl ToolListChangedNotification { + pub fn builder() -> builder::ToolListChangedNotification { + Default::default() + } +} +#[doc = "ToolListChangedNotificationParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"properties\": {"] +#[doc = " \"_meta\": {"] +#[doc = " \"description\": \"This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"additionalProperties\": {}"] +#[doc = " }"] +#[doc = " },"] +#[doc = " \"additionalProperties\": {}"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct ToolListChangedNotificationParams { + #[doc = "This parameter name is reserved by MCP to allow clients and servers to attach additional metadata to their notifications."] + #[serde( + rename = "_meta", + default, + skip_serializing_if = "::serde_json::Map::is_empty" + )] + pub meta: ::serde_json::Map<::std::string::String, ::serde_json::Value>, +} +impl ::std::convert::From<&ToolListChangedNotificationParams> + for ToolListChangedNotificationParams +{ + fn from(value: &ToolListChangedNotificationParams) -> Self { + value.clone() + } +} +impl ::std::default::Default for ToolListChangedNotificationParams { + fn default() -> Self { + Self { + meta: Default::default(), + } + } +} +impl ToolListChangedNotificationParams { + pub fn builder() -> builder::ToolListChangedNotificationParams { + Default::default() + } +} +#[doc = "Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request."] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"description\": \"Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.\","] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"method\","] +#[doc = " \"params\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"method\": {"] +#[doc = " \"type\": \"string\","] +#[doc = " \"const\": \"resources/unsubscribe\""] +#[doc = " },"] +#[doc = " \"params\": {"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of the resource to unsubscribe from.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct UnsubscribeRequest { + pub method: ::std::string::String, + pub params: UnsubscribeRequestParams, +} +impl ::std::convert::From<&UnsubscribeRequest> for UnsubscribeRequest { + fn from(value: &UnsubscribeRequest) -> Self { + value.clone() + } +} +impl UnsubscribeRequest { + pub fn builder() -> builder::UnsubscribeRequest { + Default::default() + } +} +#[doc = "UnsubscribeRequestParams"] +#[doc = r""] +#[doc = r"
JSON schema"] +#[doc = r""] +#[doc = r" ```json"] +#[doc = "{"] +#[doc = " \"type\": \"object\","] +#[doc = " \"required\": ["] +#[doc = " \"uri\""] +#[doc = " ],"] +#[doc = " \"properties\": {"] +#[doc = " \"uri\": {"] +#[doc = " \"description\": \"The URI of the resource to unsubscribe from.\","] +#[doc = " \"type\": \"string\","] +#[doc = " \"format\": \"uri\""] +#[doc = " }"] +#[doc = " }"] +#[doc = "}"] +#[doc = r" ```"] +#[doc = r"
"] +#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)] +pub struct UnsubscribeRequestParams { + #[doc = "The URI of the resource to unsubscribe from."] + pub uri: ::std::string::String, +} +impl ::std::convert::From<&UnsubscribeRequestParams> for UnsubscribeRequestParams { + fn from(value: &UnsubscribeRequestParams) -> Self { + value.clone() + } +} +impl UnsubscribeRequestParams { + pub fn builder() -> builder::UnsubscribeRequestParams { + Default::default() + } +} +#[doc = r" Types for composing complex structures."] +pub mod builder { + #[derive(Clone, Debug)] + pub struct Annotated { + annotations: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for Annotated { + fn default() -> Self { + Self { + annotations: Ok(Default::default()), + } + } + } + impl Annotated { + pub fn annotations(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.annotations = value + .try_into() + .map_err(|e| format!("error converting supplied value for annotations: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::Annotated { + type Error = super::error::ConversionError; + fn try_from( + value: Annotated, + ) -> ::std::result::Result { + Ok(Self { + annotations: value.annotations?, + }) + } + } + impl ::std::convert::From for Annotated { + fn from(value: super::Annotated) -> Self { + Self { + annotations: Ok(value.annotations), + } + } + } + #[derive(Clone, Debug)] + pub struct AnnotatedAnnotations { + audience: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + priority: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for AnnotatedAnnotations { + fn default() -> Self { + Self { + audience: Ok(Default::default()), + priority: Ok(Default::default()), + } + } + } + impl AnnotatedAnnotations { + pub fn audience(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.audience = value + .try_into() + .map_err(|e| format!("error converting supplied value for audience: {}", e)); + self + } + pub fn priority(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for priority: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::AnnotatedAnnotations { + type Error = super::error::ConversionError; + fn try_from( + value: AnnotatedAnnotations, + ) -> ::std::result::Result { + Ok(Self { + audience: value.audience?, + priority: value.priority?, + }) + } + } + impl ::std::convert::From for AnnotatedAnnotations { + fn from(value: super::AnnotatedAnnotations) -> Self { + Self { + audience: Ok(value.audience), + priority: Ok(value.priority), + } + } + } + #[derive(Clone, Debug)] + pub struct BlobResourceContents { + blob: ::std::result::Result<::std::string::String, ::std::string::String>, + mime_type: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + uri: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for BlobResourceContents { + fn default() -> Self { + Self { + blob: Err("no value supplied for blob".to_string()), + mime_type: Ok(Default::default()), + uri: Err("no value supplied for uri".to_string()), + } + } + } + impl BlobResourceContents { + pub fn blob(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.blob = value + .try_into() + .map_err(|e| format!("error converting supplied value for blob: {}", e)); + self + } + pub fn mime_type(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.mime_type = value + .try_into() + .map_err(|e| format!("error converting supplied value for mime_type: {}", e)); + self + } + pub fn uri(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::BlobResourceContents { + type Error = super::error::ConversionError; + fn try_from( + value: BlobResourceContents, + ) -> ::std::result::Result { + Ok(Self { + blob: value.blob?, + mime_type: value.mime_type?, + uri: value.uri?, + }) + } + } + impl ::std::convert::From for BlobResourceContents { + fn from(value: super::BlobResourceContents) -> Self { + Self { + blob: Ok(value.blob), + mime_type: Ok(value.mime_type), + uri: Ok(value.uri), + } + } + } + #[derive(Clone, Debug)] + pub struct CallToolRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for CallToolRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl CallToolRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CallToolRequest { + type Error = super::error::ConversionError; + fn try_from( + value: CallToolRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for CallToolRequest { + fn from(value: super::CallToolRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct CallToolRequestParams { + arguments: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + name: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for CallToolRequestParams { + fn default() -> Self { + Self { + arguments: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + } + } + } + impl CallToolRequestParams { + pub fn arguments(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.arguments = value + .try_into() + .map_err(|e| format!("error converting supplied value for arguments: {}", e)); + self + } + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CallToolRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: CallToolRequestParams, + ) -> ::std::result::Result { + Ok(Self { + arguments: value.arguments?, + name: value.name?, + }) + } + } + impl ::std::convert::From for CallToolRequestParams { + fn from(value: super::CallToolRequestParams) -> Self { + Self { + arguments: Ok(value.arguments), + name: Ok(value.name), + } + } + } + #[derive(Clone, Debug)] + pub struct CallToolResult { + content: ::std::result::Result< + ::std::vec::Vec, + ::std::string::String, + >, + is_error: ::std::result::Result<::std::option::Option, ::std::string::String>, + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for CallToolResult { + fn default() -> Self { + Self { + content: Err("no value supplied for content".to_string()), + is_error: Ok(Default::default()), + meta: Ok(Default::default()), + } + } + } + impl CallToolResult { + pub fn content(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.content = value + .try_into() + .map_err(|e| format!("error converting supplied value for content: {}", e)); + self + } + pub fn is_error(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.is_error = value + .try_into() + .map_err(|e| format!("error converting supplied value for is_error: {}", e)); + self + } + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CallToolResult { + type Error = super::error::ConversionError; + fn try_from( + value: CallToolResult, + ) -> ::std::result::Result { + Ok(Self { + content: value.content?, + is_error: value.is_error?, + meta: value.meta?, + }) + } + } + impl ::std::convert::From for CallToolResult { + fn from(value: super::CallToolResult) -> Self { + Self { + content: Ok(value.content), + is_error: Ok(value.is_error), + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct CancelledNotification { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for CancelledNotification { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl CancelledNotification { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CancelledNotification { + type Error = super::error::ConversionError; + fn try_from( + value: CancelledNotification, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for CancelledNotification { + fn from(value: super::CancelledNotification) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct CancelledNotificationParams { + reason: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + request_id: ::std::result::Result, + } + impl ::std::default::Default for CancelledNotificationParams { + fn default() -> Self { + Self { + reason: Ok(Default::default()), + request_id: Err("no value supplied for request_id".to_string()), + } + } + } + impl CancelledNotificationParams { + pub fn reason(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.reason = value + .try_into() + .map_err(|e| format!("error converting supplied value for reason: {}", e)); + self + } + pub fn request_id(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.request_id = value + .try_into() + .map_err(|e| format!("error converting supplied value for request_id: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CancelledNotificationParams { + type Error = super::error::ConversionError; + fn try_from( + value: CancelledNotificationParams, + ) -> ::std::result::Result { + Ok(Self { + reason: value.reason?, + request_id: value.request_id?, + }) + } + } + impl ::std::convert::From for CancelledNotificationParams { + fn from(value: super::CancelledNotificationParams) -> Self { + Self { + reason: Ok(value.reason), + request_id: Ok(value.request_id), + } + } + } + #[derive(Clone, Debug)] + pub struct ClientCapabilities { + experimental: ::std::result::Result< + ::std::collections::HashMap< + ::std::string::String, + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + ::std::string::String, + >, + roots: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + sampling: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for ClientCapabilities { + fn default() -> Self { + Self { + experimental: Ok(Default::default()), + roots: Ok(Default::default()), + sampling: Ok(Default::default()), + } + } + } + impl ClientCapabilities { + pub fn experimental(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::collections::HashMap< + ::std::string::String, + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + >, + T::Error: ::std::fmt::Display, + { + self.experimental = value + .try_into() + .map_err(|e| format!("error converting supplied value for experimental: {}", e)); + self + } + pub fn roots(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.roots = value + .try_into() + .map_err(|e| format!("error converting supplied value for roots: {}", e)); + self + } + pub fn sampling(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.sampling = value + .try_into() + .map_err(|e| format!("error converting supplied value for sampling: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ClientCapabilities { + type Error = super::error::ConversionError; + fn try_from( + value: ClientCapabilities, + ) -> ::std::result::Result { + Ok(Self { + experimental: value.experimental?, + roots: value.roots?, + sampling: value.sampling?, + }) + } + } + impl ::std::convert::From for ClientCapabilities { + fn from(value: super::ClientCapabilities) -> Self { + Self { + experimental: Ok(value.experimental), + roots: Ok(value.roots), + sampling: Ok(value.sampling), + } + } + } + #[derive(Clone, Debug)] + pub struct ClientCapabilitiesRoots { + list_changed: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for ClientCapabilitiesRoots { + fn default() -> Self { + Self { + list_changed: Ok(Default::default()), + } + } + } + impl ClientCapabilitiesRoots { + pub fn list_changed(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.list_changed = value + .try_into() + .map_err(|e| format!("error converting supplied value for list_changed: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ClientCapabilitiesRoots { + type Error = super::error::ConversionError; + fn try_from( + value: ClientCapabilitiesRoots, + ) -> ::std::result::Result { + Ok(Self { + list_changed: value.list_changed?, + }) + } + } + impl ::std::convert::From for ClientCapabilitiesRoots { + fn from(value: super::ClientCapabilitiesRoots) -> Self { + Self { + list_changed: Ok(value.list_changed), + } + } + } + #[derive(Clone, Debug)] + pub struct CompleteRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for CompleteRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl CompleteRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CompleteRequest { + type Error = super::error::ConversionError; + fn try_from( + value: CompleteRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for CompleteRequest { + fn from(value: super::CompleteRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct CompleteRequestParams { + argument: + ::std::result::Result, + ref_: ::std::result::Result, + } + impl ::std::default::Default for CompleteRequestParams { + fn default() -> Self { + Self { + argument: Err("no value supplied for argument".to_string()), + ref_: Err("no value supplied for ref_".to_string()), + } + } + } + impl CompleteRequestParams { + pub fn argument(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.argument = value + .try_into() + .map_err(|e| format!("error converting supplied value for argument: {}", e)); + self + } + pub fn ref_(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.ref_ = value + .try_into() + .map_err(|e| format!("error converting supplied value for ref_: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CompleteRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: CompleteRequestParams, + ) -> ::std::result::Result { + Ok(Self { + argument: value.argument?, + ref_: value.ref_?, + }) + } + } + impl ::std::convert::From for CompleteRequestParams { + fn from(value: super::CompleteRequestParams) -> Self { + Self { + argument: Ok(value.argument), + ref_: Ok(value.ref_), + } + } + } + #[derive(Clone, Debug)] + pub struct CompleteRequestParamsArgument { + name: ::std::result::Result<::std::string::String, ::std::string::String>, + value: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for CompleteRequestParamsArgument { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + value: Err("no value supplied for value".to_string()), + } + } + } + impl CompleteRequestParamsArgument { + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + pub fn value(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.value = value + .try_into() + .map_err(|e| format!("error converting supplied value for value: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::CompleteRequestParamsArgument + { + type Error = super::error::ConversionError; + fn try_from( + value: CompleteRequestParamsArgument, + ) -> ::std::result::Result { + Ok(Self { + name: value.name?, + value: value.value?, + }) + } + } + impl ::std::convert::From for CompleteRequestParamsArgument { + fn from(value: super::CompleteRequestParamsArgument) -> Self { + Self { + name: Ok(value.name), + value: Ok(value.value), + } + } + } + #[derive(Clone, Debug)] + pub struct CompleteResult { + completion: ::std::result::Result, + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for CompleteResult { + fn default() -> Self { + Self { + completion: Err("no value supplied for completion".to_string()), + meta: Ok(Default::default()), + } + } + } + impl CompleteResult { + pub fn completion(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.completion = value + .try_into() + .map_err(|e| format!("error converting supplied value for completion: {}", e)); + self + } + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CompleteResult { + type Error = super::error::ConversionError; + fn try_from( + value: CompleteResult, + ) -> ::std::result::Result { + Ok(Self { + completion: value.completion?, + meta: value.meta?, + }) + } + } + impl ::std::convert::From for CompleteResult { + fn from(value: super::CompleteResult) -> Self { + Self { + completion: Ok(value.completion), + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct CompleteResultCompletion { + has_more: ::std::result::Result<::std::option::Option, ::std::string::String>, + total: ::std::result::Result<::std::option::Option, ::std::string::String>, + values: + ::std::result::Result<::std::vec::Vec<::std::string::String>, ::std::string::String>, + } + impl ::std::default::Default for CompleteResultCompletion { + fn default() -> Self { + Self { + has_more: Ok(Default::default()), + total: Ok(Default::default()), + values: Err("no value supplied for values".to_string()), + } + } + } + impl CompleteResultCompletion { + pub fn has_more(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.has_more = value + .try_into() + .map_err(|e| format!("error converting supplied value for has_more: {}", e)); + self + } + pub fn total(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.total = value + .try_into() + .map_err(|e| format!("error converting supplied value for total: {}", e)); + self + } + pub fn values(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.values = value + .try_into() + .map_err(|e| format!("error converting supplied value for values: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CompleteResultCompletion { + type Error = super::error::ConversionError; + fn try_from( + value: CompleteResultCompletion, + ) -> ::std::result::Result { + Ok(Self { + has_more: value.has_more?, + total: value.total?, + values: value.values?, + }) + } + } + impl ::std::convert::From for CompleteResultCompletion { + fn from(value: super::CompleteResultCompletion) -> Self { + Self { + has_more: Ok(value.has_more), + total: Ok(value.total), + values: Ok(value.values), + } + } + } + #[derive(Clone, Debug)] + pub struct CreateMessageRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for CreateMessageRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl CreateMessageRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CreateMessageRequest { + type Error = super::error::ConversionError; + fn try_from( + value: CreateMessageRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for CreateMessageRequest { + fn from(value: super::CreateMessageRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct CreateMessageRequestParams { + include_context: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + max_tokens: ::std::result::Result, + messages: + ::std::result::Result<::std::vec::Vec, ::std::string::String>, + metadata: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + model_preferences: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + stop_sequences: + ::std::result::Result<::std::vec::Vec<::std::string::String>, ::std::string::String>, + system_prompt: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + temperature: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for CreateMessageRequestParams { + fn default() -> Self { + Self { + include_context: Ok(Default::default()), + max_tokens: Err("no value supplied for max_tokens".to_string()), + messages: Err("no value supplied for messages".to_string()), + metadata: Ok(Default::default()), + model_preferences: Ok(Default::default()), + stop_sequences: Ok(Default::default()), + system_prompt: Ok(Default::default()), + temperature: Ok(Default::default()), + } + } + } + impl CreateMessageRequestParams { + pub fn include_context(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::option::Option, + >, + T::Error: ::std::fmt::Display, + { + self.include_context = value + .try_into() + .map_err(|e| format!("error converting supplied value for include_context: {}", e)); + self + } + pub fn max_tokens(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.max_tokens = value + .try_into() + .map_err(|e| format!("error converting supplied value for max_tokens: {}", e)); + self + } + pub fn messages(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.messages = value + .try_into() + .map_err(|e| format!("error converting supplied value for messages: {}", e)); + self + } + pub fn metadata(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.metadata = value + .try_into() + .map_err(|e| format!("error converting supplied value for metadata: {}", e)); + self + } + pub fn model_preferences(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.model_preferences = value.try_into().map_err(|e| { + format!( + "error converting supplied value for model_preferences: {}", + e + ) + }); + self + } + pub fn stop_sequences(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.stop_sequences = value + .try_into() + .map_err(|e| format!("error converting supplied value for stop_sequences: {}", e)); + self + } + pub fn system_prompt(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.system_prompt = value + .try_into() + .map_err(|e| format!("error converting supplied value for system_prompt: {}", e)); + self + } + pub fn temperature(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.temperature = value + .try_into() + .map_err(|e| format!("error converting supplied value for temperature: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CreateMessageRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: CreateMessageRequestParams, + ) -> ::std::result::Result { + Ok(Self { + include_context: value.include_context?, + max_tokens: value.max_tokens?, + messages: value.messages?, + metadata: value.metadata?, + model_preferences: value.model_preferences?, + stop_sequences: value.stop_sequences?, + system_prompt: value.system_prompt?, + temperature: value.temperature?, + }) + } + } + impl ::std::convert::From for CreateMessageRequestParams { + fn from(value: super::CreateMessageRequestParams) -> Self { + Self { + include_context: Ok(value.include_context), + max_tokens: Ok(value.max_tokens), + messages: Ok(value.messages), + metadata: Ok(value.metadata), + model_preferences: Ok(value.model_preferences), + stop_sequences: Ok(value.stop_sequences), + system_prompt: Ok(value.system_prompt), + temperature: Ok(value.temperature), + } + } + } + #[derive(Clone, Debug)] + pub struct CreateMessageResult { + content: ::std::result::Result, + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + model: ::std::result::Result<::std::string::String, ::std::string::String>, + role: ::std::result::Result, + stop_reason: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + } + impl ::std::default::Default for CreateMessageResult { + fn default() -> Self { + Self { + content: Err("no value supplied for content".to_string()), + meta: Ok(Default::default()), + model: Err("no value supplied for model".to_string()), + role: Err("no value supplied for role".to_string()), + stop_reason: Ok(Default::default()), + } + } + } + impl CreateMessageResult { + pub fn content(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.content = value + .try_into() + .map_err(|e| format!("error converting supplied value for content: {}", e)); + self + } + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + pub fn model(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.model = value + .try_into() + .map_err(|e| format!("error converting supplied value for model: {}", e)); + self + } + pub fn role(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.role = value + .try_into() + .map_err(|e| format!("error converting supplied value for role: {}", e)); + self + } + pub fn stop_reason(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.stop_reason = value + .try_into() + .map_err(|e| format!("error converting supplied value for stop_reason: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::CreateMessageResult { + type Error = super::error::ConversionError; + fn try_from( + value: CreateMessageResult, + ) -> ::std::result::Result { + Ok(Self { + content: value.content?, + meta: value.meta?, + model: value.model?, + role: value.role?, + stop_reason: value.stop_reason?, + }) + } + } + impl ::std::convert::From for CreateMessageResult { + fn from(value: super::CreateMessageResult) -> Self { + Self { + content: Ok(value.content), + meta: Ok(value.meta), + model: Ok(value.model), + role: Ok(value.role), + stop_reason: Ok(value.stop_reason), + } + } + } + #[derive(Clone, Debug)] + pub struct EmbeddedResource { + annotations: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + resource: ::std::result::Result, + type_: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for EmbeddedResource { + fn default() -> Self { + Self { + annotations: Ok(Default::default()), + resource: Err("no value supplied for resource".to_string()), + type_: Err("no value supplied for type_".to_string()), + } + } + } + impl EmbeddedResource { + pub fn annotations(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.annotations = value + .try_into() + .map_err(|e| format!("error converting supplied value for annotations: {}", e)); + self + } + pub fn resource(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.resource = value + .try_into() + .map_err(|e| format!("error converting supplied value for resource: {}", e)); + self + } + pub fn type_(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.type_ = value + .try_into() + .map_err(|e| format!("error converting supplied value for type_: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::EmbeddedResource { + type Error = super::error::ConversionError; + fn try_from( + value: EmbeddedResource, + ) -> ::std::result::Result { + Ok(Self { + annotations: value.annotations?, + resource: value.resource?, + type_: value.type_?, + }) + } + } + impl ::std::convert::From for EmbeddedResource { + fn from(value: super::EmbeddedResource) -> Self { + Self { + annotations: Ok(value.annotations), + resource: Ok(value.resource), + type_: Ok(value.type_), + } + } + } + #[derive(Clone, Debug)] + pub struct EmbeddedResourceAnnotations { + audience: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + priority: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for EmbeddedResourceAnnotations { + fn default() -> Self { + Self { + audience: Ok(Default::default()), + priority: Ok(Default::default()), + } + } + } + impl EmbeddedResourceAnnotations { + pub fn audience(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.audience = value + .try_into() + .map_err(|e| format!("error converting supplied value for audience: {}", e)); + self + } + pub fn priority(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for priority: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::EmbeddedResourceAnnotations { + type Error = super::error::ConversionError; + fn try_from( + value: EmbeddedResourceAnnotations, + ) -> ::std::result::Result { + Ok(Self { + audience: value.audience?, + priority: value.priority?, + }) + } + } + impl ::std::convert::From for EmbeddedResourceAnnotations { + fn from(value: super::EmbeddedResourceAnnotations) -> Self { + Self { + audience: Ok(value.audience), + priority: Ok(value.priority), + } + } + } + #[derive(Clone, Debug)] + pub struct GetPromptRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for GetPromptRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl GetPromptRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::GetPromptRequest { + type Error = super::error::ConversionError; + fn try_from( + value: GetPromptRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for GetPromptRequest { + fn from(value: super::GetPromptRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct GetPromptRequestParams { + arguments: ::std::result::Result< + ::std::collections::HashMap<::std::string::String, ::std::string::String>, + ::std::string::String, + >, + name: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for GetPromptRequestParams { + fn default() -> Self { + Self { + arguments: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + } + } + } + impl GetPromptRequestParams { + pub fn arguments(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::collections::HashMap<::std::string::String, ::std::string::String>, + >, + T::Error: ::std::fmt::Display, + { + self.arguments = value + .try_into() + .map_err(|e| format!("error converting supplied value for arguments: {}", e)); + self + } + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::GetPromptRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: GetPromptRequestParams, + ) -> ::std::result::Result { + Ok(Self { + arguments: value.arguments?, + name: value.name?, + }) + } + } + impl ::std::convert::From for GetPromptRequestParams { + fn from(value: super::GetPromptRequestParams) -> Self { + Self { + arguments: Ok(value.arguments), + name: Ok(value.name), + } + } + } + #[derive(Clone, Debug)] + pub struct GetPromptResult { + description: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + messages: + ::std::result::Result<::std::vec::Vec, ::std::string::String>, + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for GetPromptResult { + fn default() -> Self { + Self { + description: Ok(Default::default()), + messages: Err("no value supplied for messages".to_string()), + meta: Ok(Default::default()), + } + } + } + impl GetPromptResult { + pub fn description(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.description = value + .try_into() + .map_err(|e| format!("error converting supplied value for description: {}", e)); + self + } + pub fn messages(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.messages = value + .try_into() + .map_err(|e| format!("error converting supplied value for messages: {}", e)); + self + } + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::GetPromptResult { + type Error = super::error::ConversionError; + fn try_from( + value: GetPromptResult, + ) -> ::std::result::Result { + Ok(Self { + description: value.description?, + messages: value.messages?, + meta: value.meta?, + }) + } + } + impl ::std::convert::From for GetPromptResult { + fn from(value: super::GetPromptResult) -> Self { + Self { + description: Ok(value.description), + messages: Ok(value.messages), + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct ImageContent { + annotations: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + data: ::std::result::Result<::std::string::String, ::std::string::String>, + mime_type: ::std::result::Result<::std::string::String, ::std::string::String>, + type_: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for ImageContent { + fn default() -> Self { + Self { + annotations: Ok(Default::default()), + data: Err("no value supplied for data".to_string()), + mime_type: Err("no value supplied for mime_type".to_string()), + type_: Err("no value supplied for type_".to_string()), + } + } + } + impl ImageContent { + pub fn annotations(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.annotations = value + .try_into() + .map_err(|e| format!("error converting supplied value for annotations: {}", e)); + self + } + pub fn data(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.data = value + .try_into() + .map_err(|e| format!("error converting supplied value for data: {}", e)); + self + } + pub fn mime_type(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.mime_type = value + .try_into() + .map_err(|e| format!("error converting supplied value for mime_type: {}", e)); + self + } + pub fn type_(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.type_ = value + .try_into() + .map_err(|e| format!("error converting supplied value for type_: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ImageContent { + type Error = super::error::ConversionError; + fn try_from( + value: ImageContent, + ) -> ::std::result::Result { + Ok(Self { + annotations: value.annotations?, + data: value.data?, + mime_type: value.mime_type?, + type_: value.type_?, + }) + } + } + impl ::std::convert::From for ImageContent { + fn from(value: super::ImageContent) -> Self { + Self { + annotations: Ok(value.annotations), + data: Ok(value.data), + mime_type: Ok(value.mime_type), + type_: Ok(value.type_), + } + } + } + #[derive(Clone, Debug)] + pub struct ImageContentAnnotations { + audience: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + priority: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for ImageContentAnnotations { + fn default() -> Self { + Self { + audience: Ok(Default::default()), + priority: Ok(Default::default()), + } + } + } + impl ImageContentAnnotations { + pub fn audience(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.audience = value + .try_into() + .map_err(|e| format!("error converting supplied value for audience: {}", e)); + self + } + pub fn priority(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for priority: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ImageContentAnnotations { + type Error = super::error::ConversionError; + fn try_from( + value: ImageContentAnnotations, + ) -> ::std::result::Result { + Ok(Self { + audience: value.audience?, + priority: value.priority?, + }) + } + } + impl ::std::convert::From for ImageContentAnnotations { + fn from(value: super::ImageContentAnnotations) -> Self { + Self { + audience: Ok(value.audience), + priority: Ok(value.priority), + } + } + } + #[derive(Clone, Debug)] + pub struct Implementation { + name: ::std::result::Result<::std::string::String, ::std::string::String>, + version: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for Implementation { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + version: Err("no value supplied for version".to_string()), + } + } + } + impl Implementation { + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + pub fn version(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.version = value + .try_into() + .map_err(|e| format!("error converting supplied value for version: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::Implementation { + type Error = super::error::ConversionError; + fn try_from( + value: Implementation, + ) -> ::std::result::Result { + Ok(Self { + name: value.name?, + version: value.version?, + }) + } + } + impl ::std::convert::From for Implementation { + fn from(value: super::Implementation) -> Self { + Self { + name: Ok(value.name), + version: Ok(value.version), + } + } + } + #[derive(Clone, Debug)] + pub struct InitializeRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for InitializeRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl InitializeRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::InitializeRequest { + type Error = super::error::ConversionError; + fn try_from( + value: InitializeRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for InitializeRequest { + fn from(value: super::InitializeRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct InitializeRequestParams { + capabilities: ::std::result::Result, + client_info: ::std::result::Result, + protocol_version: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for InitializeRequestParams { + fn default() -> Self { + Self { + capabilities: Err("no value supplied for capabilities".to_string()), + client_info: Err("no value supplied for client_info".to_string()), + protocol_version: Err("no value supplied for protocol_version".to_string()), + } + } + } + impl InitializeRequestParams { + pub fn capabilities(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.capabilities = value + .try_into() + .map_err(|e| format!("error converting supplied value for capabilities: {}", e)); + self + } + pub fn client_info(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.client_info = value + .try_into() + .map_err(|e| format!("error converting supplied value for client_info: {}", e)); + self + } + pub fn protocol_version(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.protocol_version = value.try_into().map_err(|e| { + format!( + "error converting supplied value for protocol_version: {}", + e + ) + }); + self + } + } + impl ::std::convert::TryFrom for super::InitializeRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: InitializeRequestParams, + ) -> ::std::result::Result { + Ok(Self { + capabilities: value.capabilities?, + client_info: value.client_info?, + protocol_version: value.protocol_version?, + }) + } + } + impl ::std::convert::From for InitializeRequestParams { + fn from(value: super::InitializeRequestParams) -> Self { + Self { + capabilities: Ok(value.capabilities), + client_info: Ok(value.client_info), + protocol_version: Ok(value.protocol_version), + } + } + } + #[derive(Clone, Debug)] + pub struct InitializeResult { + capabilities: ::std::result::Result, + instructions: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + protocol_version: ::std::result::Result<::std::string::String, ::std::string::String>, + server_info: ::std::result::Result, + } + impl ::std::default::Default for InitializeResult { + fn default() -> Self { + Self { + capabilities: Err("no value supplied for capabilities".to_string()), + instructions: Ok(Default::default()), + meta: Ok(Default::default()), + protocol_version: Err("no value supplied for protocol_version".to_string()), + server_info: Err("no value supplied for server_info".to_string()), + } + } + } + impl InitializeResult { + pub fn capabilities(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.capabilities = value + .try_into() + .map_err(|e| format!("error converting supplied value for capabilities: {}", e)); + self + } + pub fn instructions(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.instructions = value + .try_into() + .map_err(|e| format!("error converting supplied value for instructions: {}", e)); + self + } + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + pub fn protocol_version(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.protocol_version = value.try_into().map_err(|e| { + format!( + "error converting supplied value for protocol_version: {}", + e + ) + }); + self + } + pub fn server_info(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.server_info = value + .try_into() + .map_err(|e| format!("error converting supplied value for server_info: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::InitializeResult { + type Error = super::error::ConversionError; + fn try_from( + value: InitializeResult, + ) -> ::std::result::Result { + Ok(Self { + capabilities: value.capabilities?, + instructions: value.instructions?, + meta: value.meta?, + protocol_version: value.protocol_version?, + server_info: value.server_info?, + }) + } + } + impl ::std::convert::From for InitializeResult { + fn from(value: super::InitializeResult) -> Self { + Self { + capabilities: Ok(value.capabilities), + instructions: Ok(value.instructions), + meta: Ok(value.meta), + protocol_version: Ok(value.protocol_version), + server_info: Ok(value.server_info), + } + } + } + #[derive(Clone, Debug)] + pub struct InitializedNotification { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for InitializedNotification { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl InitializedNotification { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::InitializedNotification { + type Error = super::error::ConversionError; + fn try_from( + value: InitializedNotification, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for InitializedNotification { + fn from(value: super::InitializedNotification) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct InitializedNotificationParams { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for InitializedNotificationParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl InitializedNotificationParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::InitializedNotificationParams + { + type Error = super::error::ConversionError; + fn try_from( + value: InitializedNotificationParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From for InitializedNotificationParams { + fn from(value: super::InitializedNotificationParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct JsonrpcError { + error: ::std::result::Result, + id: ::std::result::Result, + jsonrpc: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for JsonrpcError { + fn default() -> Self { + Self { + error: Err("no value supplied for error".to_string()), + id: Err("no value supplied for id".to_string()), + jsonrpc: Err("no value supplied for jsonrpc".to_string()), + } + } + } + impl JsonrpcError { + pub fn error(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.error = value + .try_into() + .map_err(|e| format!("error converting supplied value for error: {}", e)); + self + } + pub fn id(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn jsonrpc(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.jsonrpc = value + .try_into() + .map_err(|e| format!("error converting supplied value for jsonrpc: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::JsonrpcError { + type Error = super::error::ConversionError; + fn try_from( + value: JsonrpcError, + ) -> ::std::result::Result { + Ok(Self { + error: value.error?, + id: value.id?, + jsonrpc: value.jsonrpc?, + }) + } + } + impl ::std::convert::From for JsonrpcError { + fn from(value: super::JsonrpcError) -> Self { + Self { + error: Ok(value.error), + id: Ok(value.id), + jsonrpc: Ok(value.jsonrpc), + } + } + } + #[derive(Clone, Debug)] + pub struct JsonrpcErrorError { + code: ::std::result::Result, + data: ::std::result::Result< + ::std::option::Option<::serde_json::Value>, + ::std::string::String, + >, + message: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for JsonrpcErrorError { + fn default() -> Self { + Self { + code: Err("no value supplied for code".to_string()), + data: Ok(Default::default()), + message: Err("no value supplied for message".to_string()), + } + } + } + impl JsonrpcErrorError { + pub fn code(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.code = value + .try_into() + .map_err(|e| format!("error converting supplied value for code: {}", e)); + self + } + pub fn data(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::serde_json::Value>>, + T::Error: ::std::fmt::Display, + { + self.data = value + .try_into() + .map_err(|e| format!("error converting supplied value for data: {}", e)); + self + } + pub fn message(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.message = value + .try_into() + .map_err(|e| format!("error converting supplied value for message: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::JsonrpcErrorError { + type Error = super::error::ConversionError; + fn try_from( + value: JsonrpcErrorError, + ) -> ::std::result::Result { + Ok(Self { + code: value.code?, + data: value.data?, + message: value.message?, + }) + } + } + impl ::std::convert::From for JsonrpcErrorError { + fn from(value: super::JsonrpcErrorError) -> Self { + Self { + code: Ok(value.code), + data: Ok(value.data), + message: Ok(value.message), + } + } + } + #[derive(Clone, Debug)] + pub struct JsonrpcNotification { + jsonrpc: ::std::result::Result<::std::string::String, ::std::string::String>, + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for JsonrpcNotification { + fn default() -> Self { + Self { + jsonrpc: Err("no value supplied for jsonrpc".to_string()), + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl JsonrpcNotification { + pub fn jsonrpc(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.jsonrpc = value + .try_into() + .map_err(|e| format!("error converting supplied value for jsonrpc: {}", e)); + self + } + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::JsonrpcNotification { + type Error = super::error::ConversionError; + fn try_from( + value: JsonrpcNotification, + ) -> ::std::result::Result { + Ok(Self { + jsonrpc: value.jsonrpc?, + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for JsonrpcNotification { + fn from(value: super::JsonrpcNotification) -> Self { + Self { + jsonrpc: Ok(value.jsonrpc), + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct JsonrpcNotificationParams { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for JsonrpcNotificationParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl JsonrpcNotificationParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::JsonrpcNotificationParams { + type Error = super::error::ConversionError; + fn try_from( + value: JsonrpcNotificationParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From for JsonrpcNotificationParams { + fn from(value: super::JsonrpcNotificationParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct JsonrpcRequest { + id: ::std::result::Result, + jsonrpc: ::std::result::Result<::std::string::String, ::std::string::String>, + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for JsonrpcRequest { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + jsonrpc: Err("no value supplied for jsonrpc".to_string()), + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl JsonrpcRequest { + pub fn id(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn jsonrpc(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.jsonrpc = value + .try_into() + .map_err(|e| format!("error converting supplied value for jsonrpc: {}", e)); + self + } + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::JsonrpcRequest { + type Error = super::error::ConversionError; + fn try_from( + value: JsonrpcRequest, + ) -> ::std::result::Result { + Ok(Self { + id: value.id?, + jsonrpc: value.jsonrpc?, + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for JsonrpcRequest { + fn from(value: super::JsonrpcRequest) -> Self { + Self { + id: Ok(value.id), + jsonrpc: Ok(value.jsonrpc), + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct JsonrpcRequestParams { + meta: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for JsonrpcRequestParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl JsonrpcRequestParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::JsonrpcRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: JsonrpcRequestParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From for JsonrpcRequestParams { + fn from(value: super::JsonrpcRequestParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct JsonrpcRequestParamsMeta { + progress_token: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for JsonrpcRequestParamsMeta { + fn default() -> Self { + Self { + progress_token: Ok(Default::default()), + } + } + } + impl JsonrpcRequestParamsMeta { + pub fn progress_token(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.progress_token = value + .try_into() + .map_err(|e| format!("error converting supplied value for progress_token: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::JsonrpcRequestParamsMeta { + type Error = super::error::ConversionError; + fn try_from( + value: JsonrpcRequestParamsMeta, + ) -> ::std::result::Result { + Ok(Self { + progress_token: value.progress_token?, + }) + } + } + impl ::std::convert::From for JsonrpcRequestParamsMeta { + fn from(value: super::JsonrpcRequestParamsMeta) -> Self { + Self { + progress_token: Ok(value.progress_token), + } + } + } + #[derive(Clone, Debug)] + pub struct JsonrpcResponse { + id: ::std::result::Result, + jsonrpc: ::std::result::Result<::std::string::String, ::std::string::String>, + result: ::std::result::Result, + } + impl ::std::default::Default for JsonrpcResponse { + fn default() -> Self { + Self { + id: Err("no value supplied for id".to_string()), + jsonrpc: Err("no value supplied for jsonrpc".to_string()), + result: Err("no value supplied for result".to_string()), + } + } + } + impl JsonrpcResponse { + pub fn id(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.id = value + .try_into() + .map_err(|e| format!("error converting supplied value for id: {}", e)); + self + } + pub fn jsonrpc(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.jsonrpc = value + .try_into() + .map_err(|e| format!("error converting supplied value for jsonrpc: {}", e)); + self + } + pub fn result(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.result = value + .try_into() + .map_err(|e| format!("error converting supplied value for result: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::JsonrpcResponse { + type Error = super::error::ConversionError; + fn try_from( + value: JsonrpcResponse, + ) -> ::std::result::Result { + Ok(Self { + id: value.id?, + jsonrpc: value.jsonrpc?, + result: value.result?, + }) + } + } + impl ::std::convert::From for JsonrpcResponse { + fn from(value: super::JsonrpcResponse) -> Self { + Self { + id: Ok(value.id), + jsonrpc: Ok(value.jsonrpc), + result: Ok(value.result), + } + } + } + #[derive(Clone, Debug)] + pub struct ListPromptsRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for ListPromptsRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl ListPromptsRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListPromptsRequest { + type Error = super::error::ConversionError; + fn try_from( + value: ListPromptsRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for ListPromptsRequest { + fn from(value: super::ListPromptsRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct ListPromptsRequestParams { + cursor: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + } + impl ::std::default::Default for ListPromptsRequestParams { + fn default() -> Self { + Self { + cursor: Ok(Default::default()), + } + } + } + impl ListPromptsRequestParams { + pub fn cursor(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.cursor = value + .try_into() + .map_err(|e| format!("error converting supplied value for cursor: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListPromptsRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: ListPromptsRequestParams, + ) -> ::std::result::Result { + Ok(Self { + cursor: value.cursor?, + }) + } + } + impl ::std::convert::From for ListPromptsRequestParams { + fn from(value: super::ListPromptsRequestParams) -> Self { + Self { + cursor: Ok(value.cursor), + } + } + } + #[derive(Clone, Debug)] + pub struct ListPromptsResult { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + next_cursor: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + prompts: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + impl ::std::default::Default for ListPromptsResult { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + next_cursor: Ok(Default::default()), + prompts: Err("no value supplied for prompts".to_string()), + } + } + } + impl ListPromptsResult { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + pub fn next_cursor(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.next_cursor = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_cursor: {}", e)); + self + } + pub fn prompts(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.prompts = value + .try_into() + .map_err(|e| format!("error converting supplied value for prompts: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListPromptsResult { + type Error = super::error::ConversionError; + fn try_from( + value: ListPromptsResult, + ) -> ::std::result::Result { + Ok(Self { + meta: value.meta?, + next_cursor: value.next_cursor?, + prompts: value.prompts?, + }) + } + } + impl ::std::convert::From for ListPromptsResult { + fn from(value: super::ListPromptsResult) -> Self { + Self { + meta: Ok(value.meta), + next_cursor: Ok(value.next_cursor), + prompts: Ok(value.prompts), + } + } + } + #[derive(Clone, Debug)] + pub struct ListResourceTemplatesRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for ListResourceTemplatesRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl ListResourceTemplatesRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::option::Option, + >, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListResourceTemplatesRequest { + type Error = super::error::ConversionError; + fn try_from( + value: ListResourceTemplatesRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for ListResourceTemplatesRequest { + fn from(value: super::ListResourceTemplatesRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct ListResourceTemplatesRequestParams { + cursor: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + } + impl ::std::default::Default for ListResourceTemplatesRequestParams { + fn default() -> Self { + Self { + cursor: Ok(Default::default()), + } + } + } + impl ListResourceTemplatesRequestParams { + pub fn cursor(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.cursor = value + .try_into() + .map_err(|e| format!("error converting supplied value for cursor: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::ListResourceTemplatesRequestParams + { + type Error = super::error::ConversionError; + fn try_from( + value: ListResourceTemplatesRequestParams, + ) -> ::std::result::Result { + Ok(Self { + cursor: value.cursor?, + }) + } + } + impl ::std::convert::From + for ListResourceTemplatesRequestParams + { + fn from(value: super::ListResourceTemplatesRequestParams) -> Self { + Self { + cursor: Ok(value.cursor), + } + } + } + #[derive(Clone, Debug)] + pub struct ListResourceTemplatesResult { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + next_cursor: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + resource_templates: + ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + impl ::std::default::Default for ListResourceTemplatesResult { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + next_cursor: Ok(Default::default()), + resource_templates: Err("no value supplied for resource_templates".to_string()), + } + } + } + impl ListResourceTemplatesResult { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + pub fn next_cursor(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.next_cursor = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_cursor: {}", e)); + self + } + pub fn resource_templates(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.resource_templates = value.try_into().map_err(|e| { + format!( + "error converting supplied value for resource_templates: {}", + e + ) + }); + self + } + } + impl ::std::convert::TryFrom for super::ListResourceTemplatesResult { + type Error = super::error::ConversionError; + fn try_from( + value: ListResourceTemplatesResult, + ) -> ::std::result::Result { + Ok(Self { + meta: value.meta?, + next_cursor: value.next_cursor?, + resource_templates: value.resource_templates?, + }) + } + } + impl ::std::convert::From for ListResourceTemplatesResult { + fn from(value: super::ListResourceTemplatesResult) -> Self { + Self { + meta: Ok(value.meta), + next_cursor: Ok(value.next_cursor), + resource_templates: Ok(value.resource_templates), + } + } + } + #[derive(Clone, Debug)] + pub struct ListResourcesRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for ListResourcesRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl ListResourcesRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListResourcesRequest { + type Error = super::error::ConversionError; + fn try_from( + value: ListResourcesRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for ListResourcesRequest { + fn from(value: super::ListResourcesRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct ListResourcesRequestParams { + cursor: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + } + impl ::std::default::Default for ListResourcesRequestParams { + fn default() -> Self { + Self { + cursor: Ok(Default::default()), + } + } + } + impl ListResourcesRequestParams { + pub fn cursor(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.cursor = value + .try_into() + .map_err(|e| format!("error converting supplied value for cursor: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListResourcesRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: ListResourcesRequestParams, + ) -> ::std::result::Result { + Ok(Self { + cursor: value.cursor?, + }) + } + } + impl ::std::convert::From for ListResourcesRequestParams { + fn from(value: super::ListResourcesRequestParams) -> Self { + Self { + cursor: Ok(value.cursor), + } + } + } + #[derive(Clone, Debug)] + pub struct ListResourcesResult { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + next_cursor: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + resources: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + impl ::std::default::Default for ListResourcesResult { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + next_cursor: Ok(Default::default()), + resources: Err("no value supplied for resources".to_string()), + } + } + } + impl ListResourcesResult { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + pub fn next_cursor(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.next_cursor = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_cursor: {}", e)); + self + } + pub fn resources(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.resources = value + .try_into() + .map_err(|e| format!("error converting supplied value for resources: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListResourcesResult { + type Error = super::error::ConversionError; + fn try_from( + value: ListResourcesResult, + ) -> ::std::result::Result { + Ok(Self { + meta: value.meta?, + next_cursor: value.next_cursor?, + resources: value.resources?, + }) + } + } + impl ::std::convert::From for ListResourcesResult { + fn from(value: super::ListResourcesResult) -> Self { + Self { + meta: Ok(value.meta), + next_cursor: Ok(value.next_cursor), + resources: Ok(value.resources), + } + } + } + #[derive(Clone, Debug)] + pub struct ListRootsRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for ListRootsRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl ListRootsRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListRootsRequest { + type Error = super::error::ConversionError; + fn try_from( + value: ListRootsRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for ListRootsRequest { + fn from(value: super::ListRootsRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct ListRootsRequestParams { + meta: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for ListRootsRequestParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl ListRootsRequestParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListRootsRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: ListRootsRequestParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From for ListRootsRequestParams { + fn from(value: super::ListRootsRequestParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct ListRootsRequestParamsMeta { + progress_token: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for ListRootsRequestParamsMeta { + fn default() -> Self { + Self { + progress_token: Ok(Default::default()), + } + } + } + impl ListRootsRequestParamsMeta { + pub fn progress_token(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.progress_token = value + .try_into() + .map_err(|e| format!("error converting supplied value for progress_token: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListRootsRequestParamsMeta { + type Error = super::error::ConversionError; + fn try_from( + value: ListRootsRequestParamsMeta, + ) -> ::std::result::Result { + Ok(Self { + progress_token: value.progress_token?, + }) + } + } + impl ::std::convert::From for ListRootsRequestParamsMeta { + fn from(value: super::ListRootsRequestParamsMeta) -> Self { + Self { + progress_token: Ok(value.progress_token), + } + } + } + #[derive(Clone, Debug)] + pub struct ListRootsResult { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + roots: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + impl ::std::default::Default for ListRootsResult { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + roots: Err("no value supplied for roots".to_string()), + } + } + } + impl ListRootsResult { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + pub fn roots(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.roots = value + .try_into() + .map_err(|e| format!("error converting supplied value for roots: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListRootsResult { + type Error = super::error::ConversionError; + fn try_from( + value: ListRootsResult, + ) -> ::std::result::Result { + Ok(Self { + meta: value.meta?, + roots: value.roots?, + }) + } + } + impl ::std::convert::From for ListRootsResult { + fn from(value: super::ListRootsResult) -> Self { + Self { + meta: Ok(value.meta), + roots: Ok(value.roots), + } + } + } + #[derive(Clone, Debug)] + pub struct ListToolsRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for ListToolsRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl ListToolsRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListToolsRequest { + type Error = super::error::ConversionError; + fn try_from( + value: ListToolsRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for ListToolsRequest { + fn from(value: super::ListToolsRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct ListToolsRequestParams { + cursor: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + } + impl ::std::default::Default for ListToolsRequestParams { + fn default() -> Self { + Self { + cursor: Ok(Default::default()), + } + } + } + impl ListToolsRequestParams { + pub fn cursor(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.cursor = value + .try_into() + .map_err(|e| format!("error converting supplied value for cursor: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListToolsRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: ListToolsRequestParams, + ) -> ::std::result::Result { + Ok(Self { + cursor: value.cursor?, + }) + } + } + impl ::std::convert::From for ListToolsRequestParams { + fn from(value: super::ListToolsRequestParams) -> Self { + Self { + cursor: Ok(value.cursor), + } + } + } + #[derive(Clone, Debug)] + pub struct ListToolsResult { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + next_cursor: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + tools: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + } + impl ::std::default::Default for ListToolsResult { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + next_cursor: Ok(Default::default()), + tools: Err("no value supplied for tools".to_string()), + } + } + } + impl ListToolsResult { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + pub fn next_cursor(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.next_cursor = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_cursor: {}", e)); + self + } + pub fn tools(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.tools = value + .try_into() + .map_err(|e| format!("error converting supplied value for tools: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ListToolsResult { + type Error = super::error::ConversionError; + fn try_from( + value: ListToolsResult, + ) -> ::std::result::Result { + Ok(Self { + meta: value.meta?, + next_cursor: value.next_cursor?, + tools: value.tools?, + }) + } + } + impl ::std::convert::From for ListToolsResult { + fn from(value: super::ListToolsResult) -> Self { + Self { + meta: Ok(value.meta), + next_cursor: Ok(value.next_cursor), + tools: Ok(value.tools), + } + } + } + #[derive(Clone, Debug)] + pub struct LoggingMessageNotification { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: + ::std::result::Result, + } + impl ::std::default::Default for LoggingMessageNotification { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl LoggingMessageNotification { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::LoggingMessageNotification { + type Error = super::error::ConversionError; + fn try_from( + value: LoggingMessageNotification, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for LoggingMessageNotification { + fn from(value: super::LoggingMessageNotification) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct LoggingMessageNotificationParams { + data: ::std::result::Result<::serde_json::Value, ::std::string::String>, + level: ::std::result::Result, + logger: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + } + impl ::std::default::Default for LoggingMessageNotificationParams { + fn default() -> Self { + Self { + data: Err("no value supplied for data".to_string()), + level: Err("no value supplied for level".to_string()), + logger: Ok(Default::default()), + } + } + } + impl LoggingMessageNotificationParams { + pub fn data(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::serde_json::Value>, + T::Error: ::std::fmt::Display, + { + self.data = value + .try_into() + .map_err(|e| format!("error converting supplied value for data: {}", e)); + self + } + pub fn level(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.level = value + .try_into() + .map_err(|e| format!("error converting supplied value for level: {}", e)); + self + } + pub fn logger(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.logger = value + .try_into() + .map_err(|e| format!("error converting supplied value for logger: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::LoggingMessageNotificationParams + { + type Error = super::error::ConversionError; + fn try_from( + value: LoggingMessageNotificationParams, + ) -> ::std::result::Result { + Ok(Self { + data: value.data?, + level: value.level?, + logger: value.logger?, + }) + } + } + impl ::std::convert::From + for LoggingMessageNotificationParams + { + fn from(value: super::LoggingMessageNotificationParams) -> Self { + Self { + data: Ok(value.data), + level: Ok(value.level), + logger: Ok(value.logger), + } + } + } + #[derive(Clone, Debug)] + pub struct ModelHint { + name: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + } + impl ::std::default::Default for ModelHint { + fn default() -> Self { + Self { + name: Ok(Default::default()), + } + } + } + impl ModelHint { + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ModelHint { + type Error = super::error::ConversionError; + fn try_from( + value: ModelHint, + ) -> ::std::result::Result { + Ok(Self { name: value.name? }) + } + } + impl ::std::convert::From for ModelHint { + fn from(value: super::ModelHint) -> Self { + Self { + name: Ok(value.name), + } + } + } + #[derive(Clone, Debug)] + pub struct ModelPreferences { + cost_priority: ::std::result::Result<::std::option::Option, ::std::string::String>, + hints: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + intelligence_priority: + ::std::result::Result<::std::option::Option, ::std::string::String>, + speed_priority: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for ModelPreferences { + fn default() -> Self { + Self { + cost_priority: Ok(Default::default()), + hints: Ok(Default::default()), + intelligence_priority: Ok(Default::default()), + speed_priority: Ok(Default::default()), + } + } + } + impl ModelPreferences { + pub fn cost_priority(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.cost_priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for cost_priority: {}", e)); + self + } + pub fn hints(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.hints = value + .try_into() + .map_err(|e| format!("error converting supplied value for hints: {}", e)); + self + } + pub fn intelligence_priority(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.intelligence_priority = value.try_into().map_err(|e| { + format!( + "error converting supplied value for intelligence_priority: {}", + e + ) + }); + self + } + pub fn speed_priority(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.speed_priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for speed_priority: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ModelPreferences { + type Error = super::error::ConversionError; + fn try_from( + value: ModelPreferences, + ) -> ::std::result::Result { + Ok(Self { + cost_priority: value.cost_priority?, + hints: value.hints?, + intelligence_priority: value.intelligence_priority?, + speed_priority: value.speed_priority?, + }) + } + } + impl ::std::convert::From for ModelPreferences { + fn from(value: super::ModelPreferences) -> Self { + Self { + cost_priority: Ok(value.cost_priority), + hints: Ok(value.hints), + intelligence_priority: Ok(value.intelligence_priority), + speed_priority: Ok(value.speed_priority), + } + } + } + #[derive(Clone, Debug)] + pub struct Notification { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for Notification { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl Notification { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::Notification { + type Error = super::error::ConversionError; + fn try_from( + value: Notification, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for Notification { + fn from(value: super::Notification) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct NotificationParams { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for NotificationParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl NotificationParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::NotificationParams { + type Error = super::error::ConversionError; + fn try_from( + value: NotificationParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From for NotificationParams { + fn from(value: super::NotificationParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct PaginatedRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for PaginatedRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl PaginatedRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::PaginatedRequest { + type Error = super::error::ConversionError; + fn try_from( + value: PaginatedRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for PaginatedRequest { + fn from(value: super::PaginatedRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct PaginatedRequestParams { + cursor: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + } + impl ::std::default::Default for PaginatedRequestParams { + fn default() -> Self { + Self { + cursor: Ok(Default::default()), + } + } + } + impl PaginatedRequestParams { + pub fn cursor(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.cursor = value + .try_into() + .map_err(|e| format!("error converting supplied value for cursor: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::PaginatedRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: PaginatedRequestParams, + ) -> ::std::result::Result { + Ok(Self { + cursor: value.cursor?, + }) + } + } + impl ::std::convert::From for PaginatedRequestParams { + fn from(value: super::PaginatedRequestParams) -> Self { + Self { + cursor: Ok(value.cursor), + } + } + } + #[derive(Clone, Debug)] + pub struct PaginatedResult { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + next_cursor: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + } + impl ::std::default::Default for PaginatedResult { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + next_cursor: Ok(Default::default()), + } + } + } + impl PaginatedResult { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + pub fn next_cursor(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.next_cursor = value + .try_into() + .map_err(|e| format!("error converting supplied value for next_cursor: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::PaginatedResult { + type Error = super::error::ConversionError; + fn try_from( + value: PaginatedResult, + ) -> ::std::result::Result { + Ok(Self { + meta: value.meta?, + next_cursor: value.next_cursor?, + }) + } + } + impl ::std::convert::From for PaginatedResult { + fn from(value: super::PaginatedResult) -> Self { + Self { + meta: Ok(value.meta), + next_cursor: Ok(value.next_cursor), + } + } + } + #[derive(Clone, Debug)] + pub struct PingRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for PingRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl PingRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::PingRequest { + type Error = super::error::ConversionError; + fn try_from( + value: PingRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for PingRequest { + fn from(value: super::PingRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct PingRequestParams { + meta: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for PingRequestParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl PingRequestParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::PingRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: PingRequestParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From for PingRequestParams { + fn from(value: super::PingRequestParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct PingRequestParamsMeta { + progress_token: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for PingRequestParamsMeta { + fn default() -> Self { + Self { + progress_token: Ok(Default::default()), + } + } + } + impl PingRequestParamsMeta { + pub fn progress_token(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.progress_token = value + .try_into() + .map_err(|e| format!("error converting supplied value for progress_token: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::PingRequestParamsMeta { + type Error = super::error::ConversionError; + fn try_from( + value: PingRequestParamsMeta, + ) -> ::std::result::Result { + Ok(Self { + progress_token: value.progress_token?, + }) + } + } + impl ::std::convert::From for PingRequestParamsMeta { + fn from(value: super::PingRequestParamsMeta) -> Self { + Self { + progress_token: Ok(value.progress_token), + } + } + } + #[derive(Clone, Debug)] + pub struct ProgressNotification { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for ProgressNotification { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl ProgressNotification { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ProgressNotification { + type Error = super::error::ConversionError; + fn try_from( + value: ProgressNotification, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for ProgressNotification { + fn from(value: super::ProgressNotification) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct ProgressNotificationParams { + progress: ::std::result::Result, + progress_token: ::std::result::Result, + total: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for ProgressNotificationParams { + fn default() -> Self { + Self { + progress: Err("no value supplied for progress".to_string()), + progress_token: Err("no value supplied for progress_token".to_string()), + total: Ok(Default::default()), + } + } + } + impl ProgressNotificationParams { + pub fn progress(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.progress = value + .try_into() + .map_err(|e| format!("error converting supplied value for progress: {}", e)); + self + } + pub fn progress_token(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.progress_token = value + .try_into() + .map_err(|e| format!("error converting supplied value for progress_token: {}", e)); + self + } + pub fn total(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.total = value + .try_into() + .map_err(|e| format!("error converting supplied value for total: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ProgressNotificationParams { + type Error = super::error::ConversionError; + fn try_from( + value: ProgressNotificationParams, + ) -> ::std::result::Result { + Ok(Self { + progress: value.progress?, + progress_token: value.progress_token?, + total: value.total?, + }) + } + } + impl ::std::convert::From for ProgressNotificationParams { + fn from(value: super::ProgressNotificationParams) -> Self { + Self { + progress: Ok(value.progress), + progress_token: Ok(value.progress_token), + total: Ok(value.total), + } + } + } + #[derive(Clone, Debug)] + pub struct Prompt { + arguments: + ::std::result::Result<::std::vec::Vec, ::std::string::String>, + description: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + name: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for Prompt { + fn default() -> Self { + Self { + arguments: Ok(Default::default()), + description: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + } + } + } + impl Prompt { + pub fn arguments(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.arguments = value + .try_into() + .map_err(|e| format!("error converting supplied value for arguments: {}", e)); + self + } + pub fn description(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.description = value + .try_into() + .map_err(|e| format!("error converting supplied value for description: {}", e)); + self + } + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::Prompt { + type Error = super::error::ConversionError; + fn try_from(value: Prompt) -> ::std::result::Result { + Ok(Self { + arguments: value.arguments?, + description: value.description?, + name: value.name?, + }) + } + } + impl ::std::convert::From for Prompt { + fn from(value: super::Prompt) -> Self { + Self { + arguments: Ok(value.arguments), + description: Ok(value.description), + name: Ok(value.name), + } + } + } + #[derive(Clone, Debug)] + pub struct PromptArgument { + description: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + name: ::std::result::Result<::std::string::String, ::std::string::String>, + required: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for PromptArgument { + fn default() -> Self { + Self { + description: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + required: Ok(Default::default()), + } + } + } + impl PromptArgument { + pub fn description(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.description = value + .try_into() + .map_err(|e| format!("error converting supplied value for description: {}", e)); + self + } + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + pub fn required(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.required = value + .try_into() + .map_err(|e| format!("error converting supplied value for required: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::PromptArgument { + type Error = super::error::ConversionError; + fn try_from( + value: PromptArgument, + ) -> ::std::result::Result { + Ok(Self { + description: value.description?, + name: value.name?, + required: value.required?, + }) + } + } + impl ::std::convert::From for PromptArgument { + fn from(value: super::PromptArgument) -> Self { + Self { + description: Ok(value.description), + name: Ok(value.name), + required: Ok(value.required), + } + } + } + #[derive(Clone, Debug)] + pub struct PromptListChangedNotification { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for PromptListChangedNotification { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl PromptListChangedNotification { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::option::Option, + >, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::PromptListChangedNotification + { + type Error = super::error::ConversionError; + fn try_from( + value: PromptListChangedNotification, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for PromptListChangedNotification { + fn from(value: super::PromptListChangedNotification) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct PromptListChangedNotificationParams { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for PromptListChangedNotificationParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl PromptListChangedNotificationParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::PromptListChangedNotificationParams + { + type Error = super::error::ConversionError; + fn try_from( + value: PromptListChangedNotificationParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From + for PromptListChangedNotificationParams + { + fn from(value: super::PromptListChangedNotificationParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct PromptMessage { + content: ::std::result::Result, + role: ::std::result::Result, + } + impl ::std::default::Default for PromptMessage { + fn default() -> Self { + Self { + content: Err("no value supplied for content".to_string()), + role: Err("no value supplied for role".to_string()), + } + } + } + impl PromptMessage { + pub fn content(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.content = value + .try_into() + .map_err(|e| format!("error converting supplied value for content: {}", e)); + self + } + pub fn role(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.role = value + .try_into() + .map_err(|e| format!("error converting supplied value for role: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::PromptMessage { + type Error = super::error::ConversionError; + fn try_from( + value: PromptMessage, + ) -> ::std::result::Result { + Ok(Self { + content: value.content?, + role: value.role?, + }) + } + } + impl ::std::convert::From for PromptMessage { + fn from(value: super::PromptMessage) -> Self { + Self { + content: Ok(value.content), + role: Ok(value.role), + } + } + } + #[derive(Clone, Debug)] + pub struct PromptReference { + name: ::std::result::Result<::std::string::String, ::std::string::String>, + type_: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for PromptReference { + fn default() -> Self { + Self { + name: Err("no value supplied for name".to_string()), + type_: Err("no value supplied for type_".to_string()), + } + } + } + impl PromptReference { + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + pub fn type_(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.type_ = value + .try_into() + .map_err(|e| format!("error converting supplied value for type_: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::PromptReference { + type Error = super::error::ConversionError; + fn try_from( + value: PromptReference, + ) -> ::std::result::Result { + Ok(Self { + name: value.name?, + type_: value.type_?, + }) + } + } + impl ::std::convert::From for PromptReference { + fn from(value: super::PromptReference) -> Self { + Self { + name: Ok(value.name), + type_: Ok(value.type_), + } + } + } + #[derive(Clone, Debug)] + pub struct ReadResourceRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for ReadResourceRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl ReadResourceRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ReadResourceRequest { + type Error = super::error::ConversionError; + fn try_from( + value: ReadResourceRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for ReadResourceRequest { + fn from(value: super::ReadResourceRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct ReadResourceRequestParams { + uri: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for ReadResourceRequestParams { + fn default() -> Self { + Self { + uri: Err("no value supplied for uri".to_string()), + } + } + } + impl ReadResourceRequestParams { + pub fn uri(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ReadResourceRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: ReadResourceRequestParams, + ) -> ::std::result::Result { + Ok(Self { uri: value.uri? }) + } + } + impl ::std::convert::From for ReadResourceRequestParams { + fn from(value: super::ReadResourceRequestParams) -> Self { + Self { uri: Ok(value.uri) } + } + } + #[derive(Clone, Debug)] + pub struct ReadResourceResult { + contents: ::std::result::Result< + ::std::vec::Vec, + ::std::string::String, + >, + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for ReadResourceResult { + fn default() -> Self { + Self { + contents: Err("no value supplied for contents".to_string()), + meta: Ok(Default::default()), + } + } + } + impl ReadResourceResult { + pub fn contents(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.contents = value + .try_into() + .map_err(|e| format!("error converting supplied value for contents: {}", e)); + self + } + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ReadResourceResult { + type Error = super::error::ConversionError; + fn try_from( + value: ReadResourceResult, + ) -> ::std::result::Result { + Ok(Self { + contents: value.contents?, + meta: value.meta?, + }) + } + } + impl ::std::convert::From for ReadResourceResult { + fn from(value: super::ReadResourceResult) -> Self { + Self { + contents: Ok(value.contents), + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct Request { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for Request { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl Request { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::Request { + type Error = super::error::ConversionError; + fn try_from(value: Request) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for Request { + fn from(value: super::Request) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct RequestParams { + meta: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for RequestParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl RequestParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::RequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: RequestParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From for RequestParams { + fn from(value: super::RequestParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct RequestParamsMeta { + progress_token: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for RequestParamsMeta { + fn default() -> Self { + Self { + progress_token: Ok(Default::default()), + } + } + } + impl RequestParamsMeta { + pub fn progress_token(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.progress_token = value + .try_into() + .map_err(|e| format!("error converting supplied value for progress_token: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::RequestParamsMeta { + type Error = super::error::ConversionError; + fn try_from( + value: RequestParamsMeta, + ) -> ::std::result::Result { + Ok(Self { + progress_token: value.progress_token?, + }) + } + } + impl ::std::convert::From for RequestParamsMeta { + fn from(value: super::RequestParamsMeta) -> Self { + Self { + progress_token: Ok(value.progress_token), + } + } + } + #[derive(Clone, Debug)] + pub struct Resource { + annotations: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + description: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + mime_type: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + name: ::std::result::Result<::std::string::String, ::std::string::String>, + size: ::std::result::Result<::std::option::Option, ::std::string::String>, + uri: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for Resource { + fn default() -> Self { + Self { + annotations: Ok(Default::default()), + description: Ok(Default::default()), + mime_type: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + size: Ok(Default::default()), + uri: Err("no value supplied for uri".to_string()), + } + } + } + impl Resource { + pub fn annotations(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.annotations = value + .try_into() + .map_err(|e| format!("error converting supplied value for annotations: {}", e)); + self + } + pub fn description(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.description = value + .try_into() + .map_err(|e| format!("error converting supplied value for description: {}", e)); + self + } + pub fn mime_type(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.mime_type = value + .try_into() + .map_err(|e| format!("error converting supplied value for mime_type: {}", e)); + self + } + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + pub fn size(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.size = value + .try_into() + .map_err(|e| format!("error converting supplied value for size: {}", e)); + self + } + pub fn uri(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::Resource { + type Error = super::error::ConversionError; + fn try_from(value: Resource) -> ::std::result::Result { + Ok(Self { + annotations: value.annotations?, + description: value.description?, + mime_type: value.mime_type?, + name: value.name?, + size: value.size?, + uri: value.uri?, + }) + } + } + impl ::std::convert::From for Resource { + fn from(value: super::Resource) -> Self { + Self { + annotations: Ok(value.annotations), + description: Ok(value.description), + mime_type: Ok(value.mime_type), + name: Ok(value.name), + size: Ok(value.size), + uri: Ok(value.uri), + } + } + } + #[derive(Clone, Debug)] + pub struct ResourceAnnotations { + audience: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + priority: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for ResourceAnnotations { + fn default() -> Self { + Self { + audience: Ok(Default::default()), + priority: Ok(Default::default()), + } + } + } + impl ResourceAnnotations { + pub fn audience(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.audience = value + .try_into() + .map_err(|e| format!("error converting supplied value for audience: {}", e)); + self + } + pub fn priority(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for priority: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ResourceAnnotations { + type Error = super::error::ConversionError; + fn try_from( + value: ResourceAnnotations, + ) -> ::std::result::Result { + Ok(Self { + audience: value.audience?, + priority: value.priority?, + }) + } + } + impl ::std::convert::From for ResourceAnnotations { + fn from(value: super::ResourceAnnotations) -> Self { + Self { + audience: Ok(value.audience), + priority: Ok(value.priority), + } + } + } + #[derive(Clone, Debug)] + pub struct ResourceContents { + mime_type: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + uri: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for ResourceContents { + fn default() -> Self { + Self { + mime_type: Ok(Default::default()), + uri: Err("no value supplied for uri".to_string()), + } + } + } + impl ResourceContents { + pub fn mime_type(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.mime_type = value + .try_into() + .map_err(|e| format!("error converting supplied value for mime_type: {}", e)); + self + } + pub fn uri(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ResourceContents { + type Error = super::error::ConversionError; + fn try_from( + value: ResourceContents, + ) -> ::std::result::Result { + Ok(Self { + mime_type: value.mime_type?, + uri: value.uri?, + }) + } + } + impl ::std::convert::From for ResourceContents { + fn from(value: super::ResourceContents) -> Self { + Self { + mime_type: Ok(value.mime_type), + uri: Ok(value.uri), + } + } + } + #[derive(Clone, Debug)] + pub struct ResourceListChangedNotification { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for ResourceListChangedNotification { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl ResourceListChangedNotification { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::option::Option, + >, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::ResourceListChangedNotification + { + type Error = super::error::ConversionError; + fn try_from( + value: ResourceListChangedNotification, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From + for ResourceListChangedNotification + { + fn from(value: super::ResourceListChangedNotification) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct ResourceListChangedNotificationParams { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for ResourceListChangedNotificationParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl ResourceListChangedNotificationParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::ResourceListChangedNotificationParams + { + type Error = super::error::ConversionError; + fn try_from( + value: ResourceListChangedNotificationParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From + for ResourceListChangedNotificationParams + { + fn from(value: super::ResourceListChangedNotificationParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct ResourceReference { + type_: ::std::result::Result<::std::string::String, ::std::string::String>, + uri: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for ResourceReference { + fn default() -> Self { + Self { + type_: Err("no value supplied for type_".to_string()), + uri: Err("no value supplied for uri".to_string()), + } + } + } + impl ResourceReference { + pub fn type_(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.type_ = value + .try_into() + .map_err(|e| format!("error converting supplied value for type_: {}", e)); + self + } + pub fn uri(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ResourceReference { + type Error = super::error::ConversionError; + fn try_from( + value: ResourceReference, + ) -> ::std::result::Result { + Ok(Self { + type_: value.type_?, + uri: value.uri?, + }) + } + } + impl ::std::convert::From for ResourceReference { + fn from(value: super::ResourceReference) -> Self { + Self { + type_: Ok(value.type_), + uri: Ok(value.uri), + } + } + } + #[derive(Clone, Debug)] + pub struct ResourceTemplate { + annotations: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + description: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + mime_type: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + name: ::std::result::Result<::std::string::String, ::std::string::String>, + uri_template: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for ResourceTemplate { + fn default() -> Self { + Self { + annotations: Ok(Default::default()), + description: Ok(Default::default()), + mime_type: Ok(Default::default()), + name: Err("no value supplied for name".to_string()), + uri_template: Err("no value supplied for uri_template".to_string()), + } + } + } + impl ResourceTemplate { + pub fn annotations(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.annotations = value + .try_into() + .map_err(|e| format!("error converting supplied value for annotations: {}", e)); + self + } + pub fn description(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.description = value + .try_into() + .map_err(|e| format!("error converting supplied value for description: {}", e)); + self + } + pub fn mime_type(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.mime_type = value + .try_into() + .map_err(|e| format!("error converting supplied value for mime_type: {}", e)); + self + } + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + pub fn uri_template(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri_template = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri_template: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ResourceTemplate { + type Error = super::error::ConversionError; + fn try_from( + value: ResourceTemplate, + ) -> ::std::result::Result { + Ok(Self { + annotations: value.annotations?, + description: value.description?, + mime_type: value.mime_type?, + name: value.name?, + uri_template: value.uri_template?, + }) + } + } + impl ::std::convert::From for ResourceTemplate { + fn from(value: super::ResourceTemplate) -> Self { + Self { + annotations: Ok(value.annotations), + description: Ok(value.description), + mime_type: Ok(value.mime_type), + name: Ok(value.name), + uri_template: Ok(value.uri_template), + } + } + } + #[derive(Clone, Debug)] + pub struct ResourceTemplateAnnotations { + audience: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + priority: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for ResourceTemplateAnnotations { + fn default() -> Self { + Self { + audience: Ok(Default::default()), + priority: Ok(Default::default()), + } + } + } + impl ResourceTemplateAnnotations { + pub fn audience(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.audience = value + .try_into() + .map_err(|e| format!("error converting supplied value for audience: {}", e)); + self + } + pub fn priority(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for priority: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ResourceTemplateAnnotations { + type Error = super::error::ConversionError; + fn try_from( + value: ResourceTemplateAnnotations, + ) -> ::std::result::Result { + Ok(Self { + audience: value.audience?, + priority: value.priority?, + }) + } + } + impl ::std::convert::From for ResourceTemplateAnnotations { + fn from(value: super::ResourceTemplateAnnotations) -> Self { + Self { + audience: Ok(value.audience), + priority: Ok(value.priority), + } + } + } + #[derive(Clone, Debug)] + pub struct ResourceUpdatedNotification { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: + ::std::result::Result, + } + impl ::std::default::Default for ResourceUpdatedNotification { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl ResourceUpdatedNotification { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ResourceUpdatedNotification { + type Error = super::error::ConversionError; + fn try_from( + value: ResourceUpdatedNotification, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for ResourceUpdatedNotification { + fn from(value: super::ResourceUpdatedNotification) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct ResourceUpdatedNotificationParams { + uri: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for ResourceUpdatedNotificationParams { + fn default() -> Self { + Self { + uri: Err("no value supplied for uri".to_string()), + } + } + } + impl ResourceUpdatedNotificationParams { + pub fn uri(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::ResourceUpdatedNotificationParams + { + type Error = super::error::ConversionError; + fn try_from( + value: ResourceUpdatedNotificationParams, + ) -> ::std::result::Result { + Ok(Self { uri: value.uri? }) + } + } + impl ::std::convert::From + for ResourceUpdatedNotificationParams + { + fn from(value: super::ResourceUpdatedNotificationParams) -> Self { + Self { uri: Ok(value.uri) } + } + } + #[derive(Clone, Debug)] + pub struct Result { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for Result { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl Result { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::Result { + type Error = super::error::ConversionError; + fn try_from(value: Result) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From for Result { + fn from(value: super::Result) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct Root { + name: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + uri: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for Root { + fn default() -> Self { + Self { + name: Ok(Default::default()), + uri: Err("no value supplied for uri".to_string()), + } + } + } + impl Root { + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + pub fn uri(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::Root { + type Error = super::error::ConversionError; + fn try_from(value: Root) -> ::std::result::Result { + Ok(Self { + name: value.name?, + uri: value.uri?, + }) + } + } + impl ::std::convert::From for Root { + fn from(value: super::Root) -> Self { + Self { + name: Ok(value.name), + uri: Ok(value.uri), + } + } + } + #[derive(Clone, Debug)] + pub struct RootsListChangedNotification { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for RootsListChangedNotification { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl RootsListChangedNotification { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::option::Option, + >, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::RootsListChangedNotification { + type Error = super::error::ConversionError; + fn try_from( + value: RootsListChangedNotification, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for RootsListChangedNotification { + fn from(value: super::RootsListChangedNotification) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct RootsListChangedNotificationParams { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for RootsListChangedNotificationParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl RootsListChangedNotificationParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::RootsListChangedNotificationParams + { + type Error = super::error::ConversionError; + fn try_from( + value: RootsListChangedNotificationParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From + for RootsListChangedNotificationParams + { + fn from(value: super::RootsListChangedNotificationParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct SamplingMessage { + content: ::std::result::Result, + role: ::std::result::Result, + } + impl ::std::default::Default for SamplingMessage { + fn default() -> Self { + Self { + content: Err("no value supplied for content".to_string()), + role: Err("no value supplied for role".to_string()), + } + } + } + impl SamplingMessage { + pub fn content(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.content = value + .try_into() + .map_err(|e| format!("error converting supplied value for content: {}", e)); + self + } + pub fn role(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.role = value + .try_into() + .map_err(|e| format!("error converting supplied value for role: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::SamplingMessage { + type Error = super::error::ConversionError; + fn try_from( + value: SamplingMessage, + ) -> ::std::result::Result { + Ok(Self { + content: value.content?, + role: value.role?, + }) + } + } + impl ::std::convert::From for SamplingMessage { + fn from(value: super::SamplingMessage) -> Self { + Self { + content: Ok(value.content), + role: Ok(value.role), + } + } + } + #[derive(Clone, Debug)] + pub struct ServerCapabilities { + experimental: ::std::result::Result< + ::std::collections::HashMap< + ::std::string::String, + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + ::std::string::String, + >, + logging: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + prompts: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + resources: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + tools: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for ServerCapabilities { + fn default() -> Self { + Self { + experimental: Ok(Default::default()), + logging: Ok(Default::default()), + prompts: Ok(Default::default()), + resources: Ok(Default::default()), + tools: Ok(Default::default()), + } + } + } + impl ServerCapabilities { + pub fn experimental(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::collections::HashMap< + ::std::string::String, + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + >, + T::Error: ::std::fmt::Display, + { + self.experimental = value + .try_into() + .map_err(|e| format!("error converting supplied value for experimental: {}", e)); + self + } + pub fn logging(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.logging = value + .try_into() + .map_err(|e| format!("error converting supplied value for logging: {}", e)); + self + } + pub fn prompts(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.prompts = value + .try_into() + .map_err(|e| format!("error converting supplied value for prompts: {}", e)); + self + } + pub fn resources(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.resources = value + .try_into() + .map_err(|e| format!("error converting supplied value for resources: {}", e)); + self + } + pub fn tools(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.tools = value + .try_into() + .map_err(|e| format!("error converting supplied value for tools: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ServerCapabilities { + type Error = super::error::ConversionError; + fn try_from( + value: ServerCapabilities, + ) -> ::std::result::Result { + Ok(Self { + experimental: value.experimental?, + logging: value.logging?, + prompts: value.prompts?, + resources: value.resources?, + tools: value.tools?, + }) + } + } + impl ::std::convert::From for ServerCapabilities { + fn from(value: super::ServerCapabilities) -> Self { + Self { + experimental: Ok(value.experimental), + logging: Ok(value.logging), + prompts: Ok(value.prompts), + resources: Ok(value.resources), + tools: Ok(value.tools), + } + } + } + #[derive(Clone, Debug)] + pub struct ServerCapabilitiesPrompts { + list_changed: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for ServerCapabilitiesPrompts { + fn default() -> Self { + Self { + list_changed: Ok(Default::default()), + } + } + } + impl ServerCapabilitiesPrompts { + pub fn list_changed(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.list_changed = value + .try_into() + .map_err(|e| format!("error converting supplied value for list_changed: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ServerCapabilitiesPrompts { + type Error = super::error::ConversionError; + fn try_from( + value: ServerCapabilitiesPrompts, + ) -> ::std::result::Result { + Ok(Self { + list_changed: value.list_changed?, + }) + } + } + impl ::std::convert::From for ServerCapabilitiesPrompts { + fn from(value: super::ServerCapabilitiesPrompts) -> Self { + Self { + list_changed: Ok(value.list_changed), + } + } + } + #[derive(Clone, Debug)] + pub struct ServerCapabilitiesResources { + list_changed: ::std::result::Result<::std::option::Option, ::std::string::String>, + subscribe: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for ServerCapabilitiesResources { + fn default() -> Self { + Self { + list_changed: Ok(Default::default()), + subscribe: Ok(Default::default()), + } + } + } + impl ServerCapabilitiesResources { + pub fn list_changed(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.list_changed = value + .try_into() + .map_err(|e| format!("error converting supplied value for list_changed: {}", e)); + self + } + pub fn subscribe(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.subscribe = value + .try_into() + .map_err(|e| format!("error converting supplied value for subscribe: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ServerCapabilitiesResources { + type Error = super::error::ConversionError; + fn try_from( + value: ServerCapabilitiesResources, + ) -> ::std::result::Result { + Ok(Self { + list_changed: value.list_changed?, + subscribe: value.subscribe?, + }) + } + } + impl ::std::convert::From for ServerCapabilitiesResources { + fn from(value: super::ServerCapabilitiesResources) -> Self { + Self { + list_changed: Ok(value.list_changed), + subscribe: Ok(value.subscribe), + } + } + } + #[derive(Clone, Debug)] + pub struct ServerCapabilitiesTools { + list_changed: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for ServerCapabilitiesTools { + fn default() -> Self { + Self { + list_changed: Ok(Default::default()), + } + } + } + impl ServerCapabilitiesTools { + pub fn list_changed(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.list_changed = value + .try_into() + .map_err(|e| format!("error converting supplied value for list_changed: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ServerCapabilitiesTools { + type Error = super::error::ConversionError; + fn try_from( + value: ServerCapabilitiesTools, + ) -> ::std::result::Result { + Ok(Self { + list_changed: value.list_changed?, + }) + } + } + impl ::std::convert::From for ServerCapabilitiesTools { + fn from(value: super::ServerCapabilitiesTools) -> Self { + Self { + list_changed: Ok(value.list_changed), + } + } + } + #[derive(Clone, Debug)] + pub struct SetLevelRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for SetLevelRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl SetLevelRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::SetLevelRequest { + type Error = super::error::ConversionError; + fn try_from( + value: SetLevelRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for SetLevelRequest { + fn from(value: super::SetLevelRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct SetLevelRequestParams { + level: ::std::result::Result, + } + impl ::std::default::Default for SetLevelRequestParams { + fn default() -> Self { + Self { + level: Err("no value supplied for level".to_string()), + } + } + } + impl SetLevelRequestParams { + pub fn level(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.level = value + .try_into() + .map_err(|e| format!("error converting supplied value for level: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::SetLevelRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: SetLevelRequestParams, + ) -> ::std::result::Result { + Ok(Self { + level: value.level?, + }) + } + } + impl ::std::convert::From for SetLevelRequestParams { + fn from(value: super::SetLevelRequestParams) -> Self { + Self { + level: Ok(value.level), + } + } + } + #[derive(Clone, Debug)] + pub struct SubscribeRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for SubscribeRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl SubscribeRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::SubscribeRequest { + type Error = super::error::ConversionError; + fn try_from( + value: SubscribeRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for SubscribeRequest { + fn from(value: super::SubscribeRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct SubscribeRequestParams { + uri: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for SubscribeRequestParams { + fn default() -> Self { + Self { + uri: Err("no value supplied for uri".to_string()), + } + } + } + impl SubscribeRequestParams { + pub fn uri(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::SubscribeRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: SubscribeRequestParams, + ) -> ::std::result::Result { + Ok(Self { uri: value.uri? }) + } + } + impl ::std::convert::From for SubscribeRequestParams { + fn from(value: super::SubscribeRequestParams) -> Self { + Self { uri: Ok(value.uri) } + } + } + #[derive(Clone, Debug)] + pub struct TextContent { + annotations: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + text: ::std::result::Result<::std::string::String, ::std::string::String>, + type_: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for TextContent { + fn default() -> Self { + Self { + annotations: Ok(Default::default()), + text: Err("no value supplied for text".to_string()), + type_: Err("no value supplied for type_".to_string()), + } + } + } + impl TextContent { + pub fn annotations(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.annotations = value + .try_into() + .map_err(|e| format!("error converting supplied value for annotations: {}", e)); + self + } + pub fn text(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.text = value + .try_into() + .map_err(|e| format!("error converting supplied value for text: {}", e)); + self + } + pub fn type_(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.type_ = value + .try_into() + .map_err(|e| format!("error converting supplied value for type_: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::TextContent { + type Error = super::error::ConversionError; + fn try_from( + value: TextContent, + ) -> ::std::result::Result { + Ok(Self { + annotations: value.annotations?, + text: value.text?, + type_: value.type_?, + }) + } + } + impl ::std::convert::From for TextContent { + fn from(value: super::TextContent) -> Self { + Self { + annotations: Ok(value.annotations), + text: Ok(value.text), + type_: Ok(value.type_), + } + } + } + #[derive(Clone, Debug)] + pub struct TextContentAnnotations { + audience: ::std::result::Result<::std::vec::Vec, ::std::string::String>, + priority: ::std::result::Result<::std::option::Option, ::std::string::String>, + } + impl ::std::default::Default for TextContentAnnotations { + fn default() -> Self { + Self { + audience: Ok(Default::default()), + priority: Ok(Default::default()), + } + } + } + impl TextContentAnnotations { + pub fn audience(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec>, + T::Error: ::std::fmt::Display, + { + self.audience = value + .try_into() + .map_err(|e| format!("error converting supplied value for audience: {}", e)); + self + } + pub fn priority(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option>, + T::Error: ::std::fmt::Display, + { + self.priority = value + .try_into() + .map_err(|e| format!("error converting supplied value for priority: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::TextContentAnnotations { + type Error = super::error::ConversionError; + fn try_from( + value: TextContentAnnotations, + ) -> ::std::result::Result { + Ok(Self { + audience: value.audience?, + priority: value.priority?, + }) + } + } + impl ::std::convert::From for TextContentAnnotations { + fn from(value: super::TextContentAnnotations) -> Self { + Self { + audience: Ok(value.audience), + priority: Ok(value.priority), + } + } + } + #[derive(Clone, Debug)] + pub struct TextResourceContents { + mime_type: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + text: ::std::result::Result<::std::string::String, ::std::string::String>, + uri: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for TextResourceContents { + fn default() -> Self { + Self { + mime_type: Ok(Default::default()), + text: Err("no value supplied for text".to_string()), + uri: Err("no value supplied for uri".to_string()), + } + } + } + impl TextResourceContents { + pub fn mime_type(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.mime_type = value + .try_into() + .map_err(|e| format!("error converting supplied value for mime_type: {}", e)); + self + } + pub fn text(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.text = value + .try_into() + .map_err(|e| format!("error converting supplied value for text: {}", e)); + self + } + pub fn uri(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::TextResourceContents { + type Error = super::error::ConversionError; + fn try_from( + value: TextResourceContents, + ) -> ::std::result::Result { + Ok(Self { + mime_type: value.mime_type?, + text: value.text?, + uri: value.uri?, + }) + } + } + impl ::std::convert::From for TextResourceContents { + fn from(value: super::TextResourceContents) -> Self { + Self { + mime_type: Ok(value.mime_type), + text: Ok(value.text), + uri: Ok(value.uri), + } + } + } + #[derive(Clone, Debug)] + pub struct Tool { + description: ::std::result::Result< + ::std::option::Option<::std::string::String>, + ::std::string::String, + >, + input_schema: ::std::result::Result, + name: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for Tool { + fn default() -> Self { + Self { + description: Ok(Default::default()), + input_schema: Err("no value supplied for input_schema".to_string()), + name: Err("no value supplied for name".to_string()), + } + } + } + impl Tool { + pub fn description(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.description = value + .try_into() + .map_err(|e| format!("error converting supplied value for description: {}", e)); + self + } + pub fn input_schema(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.input_schema = value + .try_into() + .map_err(|e| format!("error converting supplied value for input_schema: {}", e)); + self + } + pub fn name(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.name = value + .try_into() + .map_err(|e| format!("error converting supplied value for name: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::Tool { + type Error = super::error::ConversionError; + fn try_from(value: Tool) -> ::std::result::Result { + Ok(Self { + description: value.description?, + input_schema: value.input_schema?, + name: value.name?, + }) + } + } + impl ::std::convert::From for Tool { + fn from(value: super::Tool) -> Self { + Self { + description: Ok(value.description), + input_schema: Ok(value.input_schema), + name: Ok(value.name), + } + } + } + #[derive(Clone, Debug)] + pub struct ToolInputSchema { + properties: ::std::result::Result< + ::std::collections::HashMap< + ::std::string::String, + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + ::std::string::String, + >, + required: + ::std::result::Result<::std::vec::Vec<::std::string::String>, ::std::string::String>, + type_: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for ToolInputSchema { + fn default() -> Self { + Self { + properties: Ok(Default::default()), + required: Ok(Default::default()), + type_: Err("no value supplied for type_".to_string()), + } + } + } + impl ToolInputSchema { + pub fn properties(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::collections::HashMap< + ::std::string::String, + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + >, + T::Error: ::std::fmt::Display, + { + self.properties = value + .try_into() + .map_err(|e| format!("error converting supplied value for properties: {}", e)); + self + } + pub fn required(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>, + T::Error: ::std::fmt::Display, + { + self.required = value + .try_into() + .map_err(|e| format!("error converting supplied value for required: {}", e)); + self + } + pub fn type_(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.type_ = value + .try_into() + .map_err(|e| format!("error converting supplied value for type_: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ToolInputSchema { + type Error = super::error::ConversionError; + fn try_from( + value: ToolInputSchema, + ) -> ::std::result::Result { + Ok(Self { + properties: value.properties?, + required: value.required?, + type_: value.type_?, + }) + } + } + impl ::std::convert::From for ToolInputSchema { + fn from(value: super::ToolInputSchema) -> Self { + Self { + properties: Ok(value.properties), + required: Ok(value.required), + type_: Ok(value.type_), + } + } + } + #[derive(Clone, Debug)] + pub struct ToolListChangedNotification { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result< + ::std::option::Option, + ::std::string::String, + >, + } + impl ::std::default::Default for ToolListChangedNotification { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Ok(Default::default()), + } + } + } + impl ToolListChangedNotification { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::std::option::Option, + >, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::ToolListChangedNotification { + type Error = super::error::ConversionError; + fn try_from( + value: ToolListChangedNotification, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for ToolListChangedNotification { + fn from(value: super::ToolListChangedNotification) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct ToolListChangedNotificationParams { + meta: ::std::result::Result< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + ::std::string::String, + >, + } + impl ::std::default::Default for ToolListChangedNotificationParams { + fn default() -> Self { + Self { + meta: Ok(Default::default()), + } + } + } + impl ToolListChangedNotificationParams { + pub fn meta(mut self, value: T) -> Self + where + T: ::std::convert::TryInto< + ::serde_json::Map<::std::string::String, ::serde_json::Value>, + >, + T::Error: ::std::fmt::Display, + { + self.meta = value + .try_into() + .map_err(|e| format!("error converting supplied value for meta: {}", e)); + self + } + } + impl ::std::convert::TryFrom + for super::ToolListChangedNotificationParams + { + type Error = super::error::ConversionError; + fn try_from( + value: ToolListChangedNotificationParams, + ) -> ::std::result::Result { + Ok(Self { meta: value.meta? }) + } + } + impl ::std::convert::From + for ToolListChangedNotificationParams + { + fn from(value: super::ToolListChangedNotificationParams) -> Self { + Self { + meta: Ok(value.meta), + } + } + } + #[derive(Clone, Debug)] + pub struct UnsubscribeRequest { + method: ::std::result::Result<::std::string::String, ::std::string::String>, + params: ::std::result::Result, + } + impl ::std::default::Default for UnsubscribeRequest { + fn default() -> Self { + Self { + method: Err("no value supplied for method".to_string()), + params: Err("no value supplied for params".to_string()), + } + } + } + impl UnsubscribeRequest { + pub fn method(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.method = value + .try_into() + .map_err(|e| format!("error converting supplied value for method: {}", e)); + self + } + pub fn params(mut self, value: T) -> Self + where + T: ::std::convert::TryInto, + T::Error: ::std::fmt::Display, + { + self.params = value + .try_into() + .map_err(|e| format!("error converting supplied value for params: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::UnsubscribeRequest { + type Error = super::error::ConversionError; + fn try_from( + value: UnsubscribeRequest, + ) -> ::std::result::Result { + Ok(Self { + method: value.method?, + params: value.params?, + }) + } + } + impl ::std::convert::From for UnsubscribeRequest { + fn from(value: super::UnsubscribeRequest) -> Self { + Self { + method: Ok(value.method), + params: Ok(value.params), + } + } + } + #[derive(Clone, Debug)] + pub struct UnsubscribeRequestParams { + uri: ::std::result::Result<::std::string::String, ::std::string::String>, + } + impl ::std::default::Default for UnsubscribeRequestParams { + fn default() -> Self { + Self { + uri: Err("no value supplied for uri".to_string()), + } + } + } + impl UnsubscribeRequestParams { + pub fn uri(mut self, value: T) -> Self + where + T: ::std::convert::TryInto<::std::string::String>, + T::Error: ::std::fmt::Display, + { + self.uri = value + .try_into() + .map_err(|e| format!("error converting supplied value for uri: {}", e)); + self + } + } + impl ::std::convert::TryFrom for super::UnsubscribeRequestParams { + type Error = super::error::ConversionError; + fn try_from( + value: UnsubscribeRequestParams, + ) -> ::std::result::Result { + Ok(Self { uri: value.uri? }) + } + } + impl ::std::convert::From for UnsubscribeRequestParams { + fn from(value: super::UnsubscribeRequestParams) -> Self { + Self { uri: Ok(value.uri) } + } + } +}