#[non_exhaustive]pub enum BuildError {
Show 16 variants
DuplicateTool(String),
InvalidToolName(String),
MissingState {
handler: String,
type_name: &'static str,
},
InvalidResource {
uri: String,
reason: String,
},
DuplicateResource(String),
DuplicatePrompt(String),
InvalidPromptName(String),
InvalidCompletion {
owner: String,
argument: String,
},
InvalidHeaderAnnotation {
tool: String,
reason: String,
},
InvalidExtension(String),
InvalidLimit(&'static str),
WeakRequestStateKey,
RandomUnavailable(String),
InvalidApp {
uri: String,
reason: String,
},
InvalidScope {
handler: String,
scope: String,
},
Serialize(&'static str, Error),
}Expand description
Errors detected while building a server.
Display gives the problem in one line; BuildError::help says how to
fix it. Debug prints both, so fn main() -> Result<..> with
.build()? shows the fix too.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
DuplicateTool(String)
Two tools share a name.
InvalidToolName(String)
A tool name breaks the specification’s naming rules.
MissingState
A handler needs shared state that was not registered.
Fields
InvalidResource
A resource URI or URI template is invalid.
DuplicateResource(String)
Two resources share a URI, or two templates share a URI template.
DuplicatePrompt(String)
Two prompts share a name.
InvalidPromptName(String)
A prompt name is empty or contains control characters.
InvalidCompletion
A completion provider is attached to an unknown argument.
Fields
InvalidHeaderAnnotation
An x-mcp-header annotation breaks the specification’s constraints.
InvalidExtension(String)
An extension identifier is malformed or registered twice.
InvalidLimit(&'static str)
A limit is out of range.
WeakRequestStateKey
The requestState signing key is shorter than
MIN_REQUEST_STATE_KEY_BYTES.
No random requestState key could be generated.
InvalidApp
An MCP Apps interface or a tool’s ui is invalid.
InvalidScope
A handler declares a malformed OAuth scope.
Serialize(&'static str, Error)
A pre-serialized response could not be built.
Implementations§
Trait Implementations§
Source§impl Debug for BuildError
impl Debug for BuildError
Source§impl Display for BuildError
impl Display for BuildError
Source§impl Error for BuildError
impl Error for BuildError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()