Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions crates/goose-server/src/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use goose::permission::permission_confirmation::PrincipalType;
use goose::providers::base::{ConfigKey, ModelInfo, ProviderMetadata};
use goose::session::info::SessionInfo;
use goose::session::SessionMetadata;
use mcp_core::handler::ToolResultSchema;
use mcp_core::tool::{Tool, ToolAnnotations};
use rmcp::model::ResourceContents;
use rmcp::model::{Annotations, Content, EmbeddedResource, ImageContent, Role, TextContent};
Expand Down Expand Up @@ -348,7 +347,6 @@ derive_utoipa!(ResourceContents as ResourceContentsSchema);
TextContentSchema,
ToolResponse,
ToolRequest,
ToolResultSchema,
ToolConfirmationRequest,
ThinkingContent,
RedactedThinkingContent,
Expand Down
51 changes: 0 additions & 51 deletions crates/mcp-core/src/handler.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
use async_trait::async_trait;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[allow(unused_imports)] // this is used in schema below
use serde_json::json;
use serde_json::Value;
use thiserror::Error;
use utoipa::ToSchema;

#[non_exhaustive]
#[derive(Error, Debug, Clone, Deserialize, Serialize, PartialEq)]
Expand All @@ -22,18 +18,6 @@ pub enum ToolError {

pub type ToolResult<T> = std::result::Result<T, ToolError>;

// Define schema manually without generics issues
#[derive(ToSchema)]
#[schema(example = json!({"success": true, "data": {}}))]
pub struct ToolResultSchema {
#[schema(example = "Operation completed successfully")]
pub message: Option<String>,
#[schema(example = true)]
pub success: bool,
#[schema(value_type = Object)]
pub data: Option<serde_json::Value>,
}

#[derive(Error, Debug)]
pub enum ResourceError {
#[error("Execution failed: {0}")]
Expand All @@ -51,38 +35,3 @@ pub enum PromptError {
#[error("Prompt not found: {0}")]
NotFound(String),
}

/// Trait for implementing MCP tools
#[async_trait]
pub trait ToolHandler: Send + Sync + 'static {
/// The name of the tool
fn name(&self) -> &'static str;

/// A description of what the tool does
fn description(&self) -> &'static str;

/// JSON schema describing the tool's parameters
fn schema(&self) -> Value;

/// Execute the tool with the given parameters
async fn call(&self, params: Value) -> ToolResult<Value>;
}

/// Trait for implementing MCP resources
#[async_trait]
pub trait ResourceTemplateHandler: Send + Sync + 'static {
/// The URL template for this resource
fn template() -> &'static str;

/// JSON schema describing the resource parameters
fn schema() -> Value;

/// Get the resource value
async fn get(&self, params: Value) -> ToolResult<String>;
}

/// Helper function to generate JSON schema for a type
pub fn generate_schema<T: JsonSchema>() -> ToolResult<Value> {
let schema = schemars::schema_for!(T);
serde_json::to_value(schema).map_err(|e| ToolError::SchemaError(e.to_string()))
}
27 changes: 0 additions & 27 deletions crates/mcp-macros/Cargo.toml

This file was deleted.

53 changes: 0 additions & 53 deletions crates/mcp-macros/examples/calculator.rs

This file was deleted.

152 changes: 0 additions & 152 deletions crates/mcp-macros/src/lib.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/mcp-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ workspace = true
anyhow = "1.0.94"
thiserror = "1.0"
mcp-core = { path = "../mcp-core" }
mcp-macros = { path = "../mcp-macros" }
rmcp = { workspace = true }
serde = { version = "1.0.216", features = ["derive"] }
serde_json = "1.0.133"
Expand Down
Loading