pub struct NoParams;Expand description
A marker type for tools that take no parameters.
Use this instead of () when defining tools with no input parameters.
The unit type () generates "type": "null" in JSON Schema, which many
MCP clients reject. NoParams generates "type": "object" with no
required properties, which is the correct schema for parameterless tools.
§Example
use tower_mcp::{ToolBuilder, CallToolResult, NoParams};
let tool = ToolBuilder::new("get_status")
.description("Get current status")
.handler(|_input: NoParams| async move {
Ok(CallToolResult::text("OK"))
})
.build()
.unwrap();Trait Implementations§
Source§impl<'de> Deserialize<'de> for NoParams
impl<'de> Deserialize<'de> for NoParams
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for NoParams
impl JsonSchema for NoParams
Source§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl Copy for NoParams
impl Eq for NoParams
impl StructuralPartialEq for NoParams
Auto Trait Implementations§
impl Freeze for NoParams
impl RefUnwindSafe for NoParams
impl Send for NoParams
impl Sync for NoParams
impl Unpin for NoParams
impl UnwindSafe for NoParams
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more