refactor (cleanup): Removed mcp sampling (#12193)
This commit is contained in:
@@ -497,7 +497,6 @@ impl ExtensionManager {
|
||||
.unwrap_or_else(|| std::env::current_dir().unwrap_or_default());
|
||||
let ctx = |timeout: Option<u64>, working_dir: PathBuf| ConnectContext {
|
||||
timeout: Duration::from_secs(resolve_timeout(timeout)),
|
||||
provider: self.provider.clone(),
|
||||
client_name: self.client_name.clone(),
|
||||
capabilities: self.mcp_client_capabilities(),
|
||||
working_dir,
|
||||
|
||||
@@ -695,7 +695,6 @@ mod tests {
|
||||
fn test_ctx(working_dir: &std::path::Path) -> ConnectContext {
|
||||
ConnectContext {
|
||||
timeout: Duration::from_secs(5),
|
||||
provider: Arc::new(Mutex::new(None)),
|
||||
client_name: "goose-test".to_string(),
|
||||
capabilities: GooseMcpClientCapabilities {
|
||||
mcpui: false,
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
use crate::action_required_manager::{ActionRequiredManager, ElicitationOutcome};
|
||||
use crate::agents::extension_manager::ExtensionManager;
|
||||
use crate::agents::tool_execution::ToolCallContext;
|
||||
use crate::agents::types::SharedProvider;
|
||||
use crate::session_context::{SESSION_ID_HEADER, TOOL_CALL_REQUEST_ID_HEADER, WORKING_DIR_HEADER};
|
||||
/// MCP client implementation for Goose
|
||||
#[expect(deprecated)]
|
||||
use rmcp::model::{CreateMessageRequestParams, CreateMessageResult, SamplingMessage};
|
||||
#[expect(deprecated)]
|
||||
use rmcp::model::{
|
||||
ElicitRequestParams, ElicitResult, ListRootsResult, LoggingMessageNotification, Root,
|
||||
SamplingMessageContentBlock,
|
||||
};
|
||||
use rmcp::model::{
|
||||
ElicitationAction, ErrorCode, ExtensionCapabilities, Extensions, JsonObject, MetaObject,
|
||||
@@ -21,7 +16,7 @@ use rmcp::{
|
||||
InitializeRequestParams, InitializeResult, ListPromptsResult, ListResourcesResult,
|
||||
ListToolsResult, Notification, PaginatedRequestParams, ProtocolVersion,
|
||||
ReadResourceRequestParams, ReadResourceResult, Request, RequestId, RequestOptionalParam,
|
||||
Role, ServerNotification, ServerResult,
|
||||
ServerNotification, ServerResult,
|
||||
},
|
||||
service::{
|
||||
ClientInitializeError, ClientLifecycleMode, ClientServiceExt, PeerRequestOptions,
|
||||
@@ -50,35 +45,6 @@ pub type Error = rmcp::ServiceError;
|
||||
const MCP_APPS_UI_EXTENSION_ID: &str = "io.modelcontextprotocol/ui";
|
||||
const MCP_APPS_UI_MIME_TYPE: &str = "text/html;profile=mcp-app";
|
||||
|
||||
fn extract_sampling_text(
|
||||
content: &[crate::conversation::message::MessageContent],
|
||||
) -> Option<String> {
|
||||
let visible_content = content
|
||||
.iter()
|
||||
.filter_map(crate::conversation::message::MessageContent::user_visible_content)
|
||||
.collect::<Vec<_>>();
|
||||
let text = visible_content
|
||||
.iter()
|
||||
.filter_map(|content| match content {
|
||||
crate::conversation::message::MessageContent::Text(text)
|
||||
if !text.text.trim().is_empty() =>
|
||||
{
|
||||
Some(text.text.as_str())
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.collect::<String>();
|
||||
|
||||
(!text.is_empty()).then_some(text)
|
||||
}
|
||||
|
||||
fn resolve_sampling_model_config() -> anyhow::Result<goose_providers::model::ModelConfig> {
|
||||
let config = crate::config::Config::global();
|
||||
let provider_name = config.get_goose_provider()?;
|
||||
let model_name = config.get_goose_model()?;
|
||||
crate::model_config::model_config_from_user_config(&provider_name, &model_name)
|
||||
}
|
||||
|
||||
fn default_mcp_apps_ui_extensions() -> ExtensionCapabilities {
|
||||
let mut extensions = ExtensionCapabilities::new();
|
||||
let mut ui_extension_settings = JsonObject::new();
|
||||
@@ -205,7 +171,6 @@ impl Drop for ActiveToolCallGuard {
|
||||
|
||||
pub struct GooseClient {
|
||||
notification_handlers: Arc<Mutex<Vec<Sender<ServerNotification>>>>,
|
||||
provider: SharedProvider,
|
||||
session_id: Mutex<Option<String>>,
|
||||
active_tool_calls: Arc<StdMutex<HashMap<String, Vec<String>>>>,
|
||||
client_name: String,
|
||||
@@ -218,7 +183,6 @@ pub struct GooseClient {
|
||||
impl GooseClient {
|
||||
pub(crate) fn new(
|
||||
handlers: Arc<Mutex<Vec<Sender<ServerNotification>>>>,
|
||||
provider: SharedProvider,
|
||||
client_name: String,
|
||||
capabilities: GooseMcpClientCapabilities,
|
||||
working_dir: PathBuf,
|
||||
@@ -227,7 +191,6 @@ impl GooseClient {
|
||||
) -> Self {
|
||||
GooseClient {
|
||||
notification_handlers: handlers,
|
||||
provider,
|
||||
session_id: Mutex::new(None),
|
||||
active_tool_calls: Arc::new(StdMutex::new(HashMap::new())),
|
||||
client_name,
|
||||
@@ -429,100 +392,6 @@ impl ClientHandler for GooseClient {
|
||||
);
|
||||
}
|
||||
|
||||
#[expect(deprecated)]
|
||||
async fn create_message(
|
||||
&self,
|
||||
params: CreateMessageRequestParams,
|
||||
context: RequestContext<RoleClient>,
|
||||
) -> Result<CreateMessageResult, ErrorData> {
|
||||
let provider = self
|
||||
.provider
|
||||
.lock()
|
||||
.await
|
||||
.as_ref()
|
||||
.ok_or(ErrorData::new(
|
||||
ErrorCode::INTERNAL_ERROR,
|
||||
"Could not use provider",
|
||||
None,
|
||||
))?
|
||||
.clone();
|
||||
|
||||
// Prefer explicit MCP metadata, then the active request scope.
|
||||
let session_id = self.resolve_session_id(&context.extensions).await;
|
||||
|
||||
let provider_ready_messages: Vec<crate::conversation::message::Message> = params
|
||||
.messages
|
||||
.iter()
|
||||
.map(|msg| {
|
||||
let base = match msg.role {
|
||||
Role::User => crate::conversation::message::Message::user(),
|
||||
Role::Assistant => crate::conversation::message::Message::assistant(),
|
||||
};
|
||||
|
||||
match msg.content.first().and_then(|c| c.as_text()) {
|
||||
Some(text) => base.with_text(&text.text),
|
||||
None => base,
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
let system_prompt = params
|
||||
.system_prompt
|
||||
.as_deref()
|
||||
.unwrap_or("You are a general-purpose AI agent called goose");
|
||||
|
||||
let model_config = resolve_sampling_model_config().map_err(|e| {
|
||||
ErrorData::new(
|
||||
ErrorCode::INTERNAL_ERROR,
|
||||
"Could not resolve model config",
|
||||
Some(Value::from(e.to_string())),
|
||||
)
|
||||
})?;
|
||||
let (response, usage) = crate::session_context::with_session_id(
|
||||
session_id.clone(),
|
||||
provider.complete(&model_config, system_prompt, &provider_ready_messages, &[]),
|
||||
)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
ErrorData::new(
|
||||
ErrorCode::INTERNAL_ERROR,
|
||||
"Unexpected error while completing the prompt",
|
||||
Some(Value::from(e.to_string())),
|
||||
)
|
||||
})?;
|
||||
|
||||
let sampling_content = if let Some(text) = extract_sampling_text(&response.content) {
|
||||
SamplingMessageContentBlock::text(text)
|
||||
} else if let Some(crate::conversation::message::MessageContent::Image(img)) = response
|
||||
.content
|
||||
.iter()
|
||||
.filter_map(crate::conversation::message::MessageContent::user_visible_content)
|
||||
.find(|content| {
|
||||
matches!(
|
||||
content,
|
||||
crate::conversation::message::MessageContent::Image(_)
|
||||
)
|
||||
})
|
||||
{
|
||||
SamplingMessageContentBlock::Image(rmcp::model::ImageContent::new(
|
||||
img.data.clone(),
|
||||
img.mime_type.clone(),
|
||||
))
|
||||
} else {
|
||||
return Err(ErrorData::new(
|
||||
ErrorCode::INTERNAL_ERROR,
|
||||
"Provider returned no usable text or image content for sampling",
|
||||
None,
|
||||
));
|
||||
};
|
||||
|
||||
Ok(CreateMessageResult::new(
|
||||
SamplingMessage::new(Role::Assistant, sampling_content),
|
||||
usage.model,
|
||||
)
|
||||
.with_stop_reason(CreateMessageResult::STOP_REASON_END_TURN))
|
||||
}
|
||||
|
||||
async fn create_elicitation(
|
||||
&self,
|
||||
request: ElicitRequestParams,
|
||||
@@ -599,7 +468,6 @@ impl ClientHandler for GooseClient {
|
||||
ClientCapabilities::builder()
|
||||
.enable_roots()
|
||||
.enable_extensions_with(extensions)
|
||||
.enable_sampling()
|
||||
.enable_elicitation()
|
||||
.build(),
|
||||
self.resolved_client_info(),
|
||||
@@ -638,7 +506,6 @@ impl std::fmt::Debug for GooseMcpClientCapabilities {
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct ConnectContext {
|
||||
pub timeout: Duration,
|
||||
pub provider: SharedProvider,
|
||||
pub client_name: String,
|
||||
pub capabilities: GooseMcpClientCapabilities,
|
||||
pub working_dir: PathBuf,
|
||||
@@ -667,7 +534,6 @@ impl McpClient {
|
||||
{
|
||||
let ConnectContext {
|
||||
timeout,
|
||||
provider,
|
||||
client_name,
|
||||
capabilities,
|
||||
working_dir,
|
||||
@@ -680,7 +546,6 @@ impl McpClient {
|
||||
|
||||
let client = GooseClient::new(
|
||||
notification_subscribers.clone(),
|
||||
provider,
|
||||
client_name.clone(),
|
||||
capabilities.clone(),
|
||||
working_dir,
|
||||
@@ -1171,74 +1036,6 @@ fn inject_session_context_into_request(
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn sampling_text_preserves_text_first_provider_responses() {
|
||||
let response = crate::conversation::message::Message::assistant().with_text("answer");
|
||||
|
||||
assert_eq!(
|
||||
extract_sampling_text(&response.content).as_deref(),
|
||||
Some("answer")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sampling_text_skips_thinking_before_final_text() {
|
||||
let response = crate::conversation::message::Message::assistant()
|
||||
.with_thinking("internal reasoning", "signature")
|
||||
.with_text("final answer");
|
||||
|
||||
assert_eq!(
|
||||
extract_sampling_text(&response.content).as_deref(),
|
||||
Some("final answer")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sampling_text_preserves_fragments_around_thinking() {
|
||||
let response = crate::conversation::message::Message::assistant()
|
||||
.with_text("first")
|
||||
.with_thinking("internal reasoning", "signature")
|
||||
.with_text(" second");
|
||||
|
||||
assert_eq!(
|
||||
extract_sampling_text(&response.content).as_deref(),
|
||||
Some("first second")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sampling_text_excludes_assistant_only_blocks_without_changing_visible_text() {
|
||||
let assistant_only = rmcp::model::TextContent::new("assistant only").with_annotations(
|
||||
rmcp::model::Annotations::default().with_audience(vec![Role::Assistant]),
|
||||
);
|
||||
let response = crate::conversation::message::Message::assistant()
|
||||
.with_text("Hello")
|
||||
.with_content(crate::conversation::message::MessageContent::Text(
|
||||
assistant_only,
|
||||
))
|
||||
.with_text(" world");
|
||||
|
||||
assert_eq!(
|
||||
extract_sampling_text(&response.content).as_deref(),
|
||||
Some("Hello world")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sampling_text_rejects_thinking_only_responses() {
|
||||
let response = crate::conversation::message::Message::assistant()
|
||||
.with_thinking("internal reasoning", "signature");
|
||||
|
||||
assert_eq!(extract_sampling_text(&response.content), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sampling_does_not_expose_json_from_thinking_only_response() {
|
||||
let response = crate::conversation::message::Message::assistant()
|
||||
.with_thinking("{\"private\":true}", "signature");
|
||||
|
||||
assert_eq!(extract_sampling_text(&response.content), None);
|
||||
}
|
||||
use crate::agents::extension::ExtensionConfig;
|
||||
use crate::agents::GoosePlatform;
|
||||
use rmcp::model::Tool;
|
||||
@@ -1314,7 +1111,6 @@ mod tests {
|
||||
|
||||
GooseClient::new(
|
||||
Arc::new(Mutex::new(Vec::new())),
|
||||
Arc::new(Mutex::new(None)),
|
||||
platform.to_string(),
|
||||
capabilities,
|
||||
std::env::current_dir().unwrap_or_default(),
|
||||
@@ -1348,7 +1144,6 @@ mod tests {
|
||||
|
||||
let goose_client = GooseClient::new(
|
||||
Arc::new(Mutex::new(Vec::new())),
|
||||
Arc::new(Mutex::new(None)),
|
||||
"goose-test".to_string(),
|
||||
GooseMcpClientCapabilities {
|
||||
mcpui: false,
|
||||
@@ -1717,11 +1512,18 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_client_capabilities_do_not_advertise_sampling() {
|
||||
let client = new_client(GoosePlatform::GooseCli);
|
||||
let info = ClientHandler::get_info(&client);
|
||||
let capabilities = serde_json::to_value(info.capabilities).unwrap();
|
||||
assert!(capabilities.get("sampling").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_explicit_host_info_passes_through_client_identity() {
|
||||
let client = GooseClient::new(
|
||||
Arc::new(Mutex::new(Vec::new())),
|
||||
Arc::new(Mutex::new(None)),
|
||||
GoosePlatform::GooseDesktop.to_string(),
|
||||
GooseMcpClientCapabilities {
|
||||
mcpui: true,
|
||||
@@ -1756,7 +1558,6 @@ mod tests {
|
||||
fn test_explicit_host_extensions_override_platform_fallback() {
|
||||
let client = GooseClient::new(
|
||||
Arc::new(Mutex::new(Vec::new())),
|
||||
Arc::new(Mutex::new(None)),
|
||||
GoosePlatform::GooseCli.to_string(),
|
||||
GooseMcpClientCapabilities {
|
||||
mcpui: false,
|
||||
@@ -1788,7 +1589,6 @@ mod tests {
|
||||
fn test_host_identity_does_not_disable_platform_fallback_without_explicit_extensions() {
|
||||
let client = GooseClient::new(
|
||||
Arc::new(Mutex::new(Vec::new())),
|
||||
Arc::new(Mutex::new(None)),
|
||||
GoosePlatform::GooseDesktop.to_string(),
|
||||
GooseMcpClientCapabilities {
|
||||
mcpui: true,
|
||||
|
||||
@@ -6,24 +6,16 @@ use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::{env, fs};
|
||||
|
||||
use rmcp::model::{CallToolRequestParams, CallToolResult, Tool};
|
||||
use rmcp::model::{CallToolRequestParams, CallToolResult};
|
||||
use rmcp::object;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
use goose::agents::extension::{Envs, ExtensionConfig};
|
||||
use goose::agents::extension_manager::{ExtensionManager, ExtensionManagerCapabilities};
|
||||
use goose::agents::GoosePlatform;
|
||||
use goose_providers::model::ModelConfig;
|
||||
|
||||
use test_case::test_case;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use goose::conversation::message::Message;
|
||||
use goose::providers::base::{
|
||||
stream_from_single_message, MessageStream, Provider, ProviderDef, ProviderMetadata,
|
||||
};
|
||||
use goose_providers::conversation::token_usage::{ProviderUsage, Usage};
|
||||
use goose_providers::errors::ProviderError;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::process::Command;
|
||||
|
||||
@@ -40,51 +32,6 @@ struct Target {
|
||||
kind: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct MockProvider;
|
||||
|
||||
impl MockProvider {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl goose::providers::base::ProviderDescriptor for MockProvider {
|
||||
fn metadata() -> ProviderMetadata {
|
||||
ProviderMetadata::empty()
|
||||
}
|
||||
}
|
||||
|
||||
impl ProviderDef for MockProvider {
|
||||
type Provider = Self;
|
||||
|
||||
fn from_env(
|
||||
_extensions: Vec<goose::config::ExtensionConfig>,
|
||||
_tls_config: Option<goose::providers::api_client::TlsConfig>,
|
||||
) -> futures::future::BoxFuture<'static, anyhow::Result<Self>> {
|
||||
Box::pin(async move { Ok(Self::new()) })
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Provider for MockProvider {
|
||||
fn get_name(&self) -> &str {
|
||||
"mock"
|
||||
}
|
||||
|
||||
async fn stream(
|
||||
&self,
|
||||
_model_config: &ModelConfig,
|
||||
_system: &str,
|
||||
_messages: &[Message],
|
||||
_tools: &[Tool],
|
||||
) -> Result<MessageStream, ProviderError> {
|
||||
let message = Message::assistant().with_text("\"So we beat on, boats against the current, borne back ceaselessly into the past.\" — F. Scott Fitzgerald, The Great Gatsby (1925)");
|
||||
let usage = ProviderUsage::new("mock".to_string(), Usage::default());
|
||||
Ok(stream_from_single_message(message, usage))
|
||||
}
|
||||
}
|
||||
|
||||
fn build_and_get_binary_path() -> PathBuf {
|
||||
let output = Command::new("cargo")
|
||||
.args([
|
||||
@@ -134,8 +81,7 @@ enum TestMode {
|
||||
CallToolRequestParams::new("echo").with_arguments(object!({"message": "Hello, world!" })),
|
||||
CallToolRequestParams::new("get-sum").with_arguments(object!({"a": 1, "b": 2 })),
|
||||
CallToolRequestParams::new("trigger-long-running-operation").with_arguments(object!({"duration": 1, "steps": 5 })),
|
||||
CallToolRequestParams::new("get-structured-content").with_arguments(object!({"location": "New York"})),
|
||||
CallToolRequestParams::new("trigger-sampling-request").with_arguments(object!({"prompt": "Please provide a quote from The Great Gatsby", "maxTokens": 100 }))
|
||||
CallToolRequestParams::new("get-structured-content").with_arguments(object!({"location": "New York"}))
|
||||
],
|
||||
vec![]
|
||||
)]
|
||||
@@ -177,8 +123,6 @@ async fn test_replayed_session(
|
||||
|
||||
let _env = env_lock::lock_env([
|
||||
("GOOSE_MCP_CLIENT_VERSION", Some("0.0.0")),
|
||||
("GOOSE_PROVIDER", Some("openai")),
|
||||
("GOOSE_MODEL", Some("gpt-4o")),
|
||||
("GOOSE_WORKING_DIR", Some(TEST_WORKING_DIR)),
|
||||
]);
|
||||
|
||||
@@ -256,15 +200,12 @@ async fn test_replayed_session(
|
||||
available_tools: vec![],
|
||||
};
|
||||
|
||||
let provider = Arc::new(tokio::sync::Mutex::new(Some(
|
||||
Arc::new(MockProvider::new()) as Arc<dyn Provider>
|
||||
)));
|
||||
let temp_dir = tempfile::tempdir().unwrap();
|
||||
let session_manager = Arc::new(goose::session::SessionManager::new(
|
||||
temp_dir.path().to_path_buf(),
|
||||
));
|
||||
let extension_manager = Arc::new(ExtensionManager::new(
|
||||
provider,
|
||||
Arc::new(tokio::sync::Mutex::new(None)),
|
||||
session_manager,
|
||||
None,
|
||||
GoosePlatform::GooseDesktop.to_string(),
|
||||
|
||||
File diff suppressed because one or more lines are too long
+2
-6
@@ -1,7 +1,7 @@
|
||||
STDIN: {"jsonrpc":"2.0","id":0,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"goose-desktop","version":"0.0.0"},"io.modelcontextprotocol/clientCapabilities":{"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"roots":{},"sampling":{},"elicitation":{}}}}}
|
||||
STDIN: {"jsonrpc":"2.0","id":0,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"goose-desktop","version":"0.0.0"},"io.modelcontextprotocol/clientCapabilities":{"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"roots":{},"elicitation":{}}}}}
|
||||
STDERR: Starting default (STDIO) server...
|
||||
STDOUT: {"jsonrpc":"2.0","id":0,"error":{"code":-32601,"message":"Method not found"}}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"roots":{},"sampling":{},"elicitation":{}},"clientInfo":{"name":"goose-desktop","version":"0.0.0"}}}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"roots":{},"elicitation":{}},"clientInfo":{"name":"goose-desktop","version":"0.0.0"}}}
|
||||
STDOUT: {"result":{"protocolVersion":"2025-11-25","capabilities":{"tools":{"listChanged":true},"prompts":{"listChanged":true},"resources":{"subscribe":true,"listChanged":true},"logging":{},"completions":{}},"serverInfo":{"name":"mcp-servers/everything","title":"Everything Reference Server","version":"2.0.0"},"instructions":"# Everything Server – Server Instructions\n\nAudience: These instructions are written for an LLM or autonomous agent integrating with the Everything MCP Server.\nFollow them to use, extend, and troubleshoot the server safely and effectively.\n\n## Cross-Feature Relationships\n\n- Use `get-roots-list` to see client workspace roots before file operations\n- `gzip-file-as-resource` creates session-scoped resources accessible only during the current session\n- Enable `toggle-simulated-logging` before debugging to see server log messages\n- Enable `toggle-subscriber-updates` to receive periodic resource update notifications\n\n## Constraints & Limitations\n\n- `gzip-file-as-resource`: Max fetch size controlled by `GZIP_MAX_FETCH_SIZE` (default 10MB), timeout by `GZIP_MAX_FETCH_TIME_MILLIS` (default 30s), allowed domains by `GZIP_ALLOWED_DOMAINS`\n- Session resources are ephemeral and lost when the session ends\n- Sampling requests (`trigger-sampling-request`) require client sampling capability\n- Elicitation requests (`trigger-elicitation-request`) require client elicitation capability\n\n## Operational Patterns\n\n- For long operations, use `trigger-long-running-operation` which sends progress notifications\n- Prefer reading resources before calling mutating tools\n- Check `get-roots-list` output to understand the client's workspace context\n\n## Easter Egg\n\nIf asked about server instructions, respond with \"🎉 Server instructions are working! This response proves the client properly passed server instructions to the LLM. This demonstrates MCP's instructions feature in action.\"\n"},"jsonrpc":"2.0","id":1}
|
||||
STDIN: {"jsonrpc":"2.0","method":"notifications/initialized"}
|
||||
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/list","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0}}}
|
||||
@@ -27,7 +27,3 @@ STDOUT: {"method":"notifications/progress","params":{"progress":5,"total":5,"pro
|
||||
STDOUT: {"result":{"content":[{"type":"text","text":"Long running operation completed. Duration: 1 seconds, Steps: 5."}]},"jsonrpc":"2.0","id":6}
|
||||
STDIN: {"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","agent-tool-call-request-id":"test-id","progressToken":5},"name":"get-structured-content","arguments":{"location":"New York"}}}
|
||||
STDOUT: {"result":{"content":[{"type":"text","text":"{\"temperature\":33,\"conditions\":\"Cloudy\",\"humidity\":82}"}],"structuredContent":{"temperature":33,"conditions":"Cloudy","humidity":82}},"jsonrpc":"2.0","id":7}
|
||||
STDIN: {"jsonrpc":"2.0","id":8,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","agent-tool-call-request-id":"test-id","progressToken":6},"name":"trigger-sampling-request","arguments":{"prompt":"Please provide a quote from The Great Gatsby","maxTokens":100}}}
|
||||
STDOUT: {"method":"sampling/createMessage","params":{"messages":[{"role":"user","content":{"type":"text","text":"Resource trigger-sampling-request context: Please provide a quote from The Great Gatsby"}}],"systemPrompt":"You are a helpful test server.","maxTokens":100,"temperature":0.7},"jsonrpc":"2.0","id":1}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"result":{"model":"mock","stopReason":"endTurn","role":"assistant","content":{"type":"text","text":"\"So we beat on, boats against the current, borne back ceaselessly into the past.\" — F. Scott Fitzgerald, The Great Gatsby (1925)"}}}
|
||||
STDOUT: {"result":{"content":[{"type":"text","text":"LLM sampling result: \n{\n \"model\": \"mock\",\n \"stopReason\": \"endTurn\",\n \"role\": \"assistant\",\n \"content\": {\n \"type\": \"text\",\n \"text\": \"\\\"So we beat on, boats against the current, borne back ceaselessly into the past.\\\" — F. Scott Fitzgerald, The Great Gatsby (1925)\"\n }\n}"}]},"jsonrpc":"2.0","id":8}
|
||||
|
||||
+1
-9
@@ -35,13 +35,5 @@
|
||||
"conditions": "Cloudy",
|
||||
"humidity": 82
|
||||
}
|
||||
},
|
||||
{
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": "LLM sampling result: \n{\n \"model\": \"mock\",\n \"stopReason\": \"endTurn\",\n \"role\": \"assistant\",\n \"content\": {\n \"type\": \"text\",\n \"text\": \"\\\"So we beat on, boats against the current, borne back ceaselessly into the past.\\\" — F. Scott Fitzgerald, The Great Gatsby (1925)\"\n }\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
STDIN: {"jsonrpc":"2.0","id":0,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"goose-desktop","version":"0.0.0"},"io.modelcontextprotocol/clientCapabilities":{"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"roots":{},"sampling":{},"elicitation":{}}}}}
|
||||
STDIN: {"jsonrpc":"2.0","id":0,"method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"goose-desktop","version":"0.0.0"},"io.modelcontextprotocol/clientCapabilities":{"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"roots":{},"elicitation":{}}}}}
|
||||
STDERR: warning: The `native-tls` setting is deprecated and will be removed in a future release. Use `system-certs` instead.
|
||||
STDERR: /Users/jackamadeo/.cache/uv/archive-v0/bp02wML-MrQTiYuR/lib/python3.14/site-packages/fastmcp/server/auth/providers/jwt.py:10: AuthlibDeprecationWarning: authlib.jose module is deprecated, please use joserfc instead.
|
||||
STDERR: It will be compatible before version 2.0.0.
|
||||
@@ -131,7 +131,7 @@ STDERR: CancelTaskRequest.params.taskId
|
||||
STDERR: Field required [type=missing, input_value={'_meta': {'io.modelconte...{}, 'elicitation': {}}}}, input_type=dict]
|
||||
STDERR: For further information visit https://errors.pydantic.dev/2.13/v/missing
|
||||
STDOUT: {"jsonrpc":"2.0","id":0,"error":{"code":-32602,"message":"Invalid request parameters","data":""}}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"roots":{},"sampling":{},"elicitation":{}},"clientInfo":{"name":"goose-desktop","version":"0.0.0"}}}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"roots":{},"elicitation":{}},"clientInfo":{"name":"goose-desktop","version":"0.0.0"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","capabilities":{"experimental":{},"prompts":{"listChanged":false},"resources":{"subscribe":false,"listChanged":false},"tools":{"listChanged":true},"tasks":{"list":{},"cancel":{},"requests":{"tools":{"call":{}},"prompts":{"get":{}},"resources":{"read":{}}}}},"serverInfo":{"name":"mymcp","version":"2.14.4"}}}
|
||||
STDIN: {"jsonrpc":"2.0","method":"notifications/initialized"}
|
||||
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/list","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0}}}
|
||||
|
||||
Reference in New Issue
Block a user