systemprompt-provider-contracts 0.32.2

Provider trait contracts for systemprompt.io AI governance infrastructure. LlmProvider, ToolProvider, JobContext and friends — swap Anthropic, OpenAI, Gemini, and local models at profile level.
Documentation
//! Typed error returned by [`crate::tool::ToolProvider`] implementations.
//!
//! Copyright (c) systemprompt.io — Business Source License 1.1.
//! See <https://systemprompt.io> for licensing details.

use thiserror::Error;

#[derive(Debug, Error)]
pub enum ToolProviderError {
    #[error("Tool '{0}' not found")]
    ToolNotFound(String),

    #[error("Service '{0}' not found")]
    ServiceNotFound(String),

    #[error("Failed to connect to service '{service}': {message}")]
    ConnectionFailed { service: String, message: String },

    #[error("Tool execution failed: {0}")]
    ExecutionFailed(String),

    #[error("Authorization failed: {0}")]
    AuthorizationFailed(String),

    #[error("Configuration error: {message}")]
    ConfigurationError { message: String },

    #[error("Configuration unavailable: {message}")]
    Config {
        message: String,
        #[source]
        source: Box<dyn std::error::Error + Send + Sync>,
    },

    #[error("Internal error: {0}")]
    Internal(String),
}

pub type ToolProviderResult<T> = Result<T, ToolProviderError>;