[goose2] MCP Apps: hydrate and replay app payloads in Goose2 (#8632)
Signed-off-by: Andrew Harvard <aharvard@squareup.com>
This commit is contained in:
@@ -81,8 +81,8 @@ pub fn playback(log_file_path: &String) -> io::Result<()> {
|
||||
writeln!(
|
||||
&errors_file,
|
||||
"expected:\n{}\ngot:\n{}",
|
||||
serde_json::to_string(&input_value)?,
|
||||
serde_json::to_string(&entry_value)?
|
||||
serde_json::to_string(&entry_value)?,
|
||||
serde_json::to_string(&input_value)?
|
||||
)?;
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ use crate::acp::fs::AcpTools;
|
||||
use crate::acp::tools::AcpAwareToolMeta;
|
||||
use crate::acp::{PermissionDecision, ACP_CURRENT_MODEL};
|
||||
use crate::agents::extension::{Envs, PLATFORM_EXTENSIONS};
|
||||
use crate::agents::extension_manager::TRUSTED_TOOL_UPDATE_META_KEY;
|
||||
use crate::agents::mcp_client::{GooseMcpHostInfo, McpClientTrait};
|
||||
use crate::agents::platform_extensions::developer::DeveloperClient;
|
||||
use crate::agents::{Agent, AgentConfig, ExtensionConfig, GoosePlatform, SessionConfig};
|
||||
@@ -1532,12 +1533,11 @@ impl GooseAcpAgent {
|
||||
}
|
||||
}
|
||||
|
||||
let update = ToolCallUpdate::new(ToolCallId::new(tool_response.id.clone()), fields)
|
||||
.meta(extract_tool_call_update_meta(tool_response));
|
||||
cx.send_notification(SessionNotification::new(
|
||||
session_id.clone(),
|
||||
SessionUpdate::ToolCallUpdate(ToolCallUpdate::new(
|
||||
ToolCallId::new(tool_response.id.clone()),
|
||||
fields,
|
||||
)),
|
||||
SessionUpdate::ToolCallUpdate(update),
|
||||
))?;
|
||||
|
||||
Ok(())
|
||||
@@ -1629,6 +1629,21 @@ fn outcome_to_confirmation(outcome: &RequestPermissionOutcome) -> PermissionConf
|
||||
}
|
||||
}
|
||||
|
||||
fn extract_tool_call_update_meta(
|
||||
tool_response: &crate::conversation::message::ToolResponse,
|
||||
) -> Option<Meta> {
|
||||
let tool_result = tool_response.tool_result.as_ref().ok()?;
|
||||
let goose_meta = tool_result
|
||||
.meta
|
||||
.as_ref()?
|
||||
.0
|
||||
.get(TRUSTED_TOOL_UPDATE_META_KEY)?
|
||||
.clone();
|
||||
let mut meta_map = serde_json::Map::new();
|
||||
meta_map.insert("goose".to_string(), goose_meta);
|
||||
Some(meta_map)
|
||||
}
|
||||
|
||||
fn build_tool_call_content(tool_result: &ToolResult<CallToolResult>) -> Vec<ToolCallContent> {
|
||||
match tool_result {
|
||||
Ok(result) => result
|
||||
@@ -2144,12 +2159,12 @@ impl GooseAcpAgent {
|
||||
}
|
||||
}
|
||||
|
||||
let update =
|
||||
ToolCallUpdate::new(ToolCallId::new(tool_response.id.clone()), fields)
|
||||
.meta(extract_tool_call_update_meta(tool_response));
|
||||
cx.send_notification(SessionNotification::new(
|
||||
args.session_id.clone(),
|
||||
SessionUpdate::ToolCallUpdate(ToolCallUpdate::new(
|
||||
ToolCallId::new(tool_response.id.clone()),
|
||||
fields,
|
||||
)),
|
||||
SessionUpdate::ToolCallUpdate(update),
|
||||
))?;
|
||||
}
|
||||
MessageContent::Thinking(thinking) => {
|
||||
@@ -4409,6 +4424,49 @@ print(\"hello, world\")
|
||||
.map(|locs| locs.into_iter().map(|loc| (loc.path, loc.line)).collect())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_tool_call_update_meta_ignores_untrusted_goose_meta() {
|
||||
let response = response_with_meta(Some(serde_json::json!({
|
||||
"goose": {
|
||||
"mcpApp": {
|
||||
"resourceUri": "ui://spoofed/app",
|
||||
},
|
||||
},
|
||||
})));
|
||||
|
||||
assert_eq!(extract_tool_call_update_meta(&response), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_extract_tool_call_update_meta_uses_trusted_meta_only() {
|
||||
let response = response_with_meta(Some(serde_json::json!({
|
||||
"goose": {
|
||||
"mcpApp": {
|
||||
"resourceUri": "ui://spoofed/app",
|
||||
},
|
||||
},
|
||||
TRUSTED_TOOL_UPDATE_META_KEY: {
|
||||
"mcpApp": {
|
||||
"resourceUri": "ui://trusted/app",
|
||||
"extensionName": "weather",
|
||||
"toolName": "weather__render",
|
||||
},
|
||||
},
|
||||
})));
|
||||
|
||||
let extracted = extract_tool_call_update_meta(&response).expect("expected trusted meta");
|
||||
assert_eq!(
|
||||
extracted.get("goose"),
|
||||
Some(&serde_json::json!({
|
||||
"mcpApp": {
|
||||
"resourceUri": "ui://trusted/app",
|
||||
"extensionName": "weather",
|
||||
"toolName": "weather__render",
|
||||
},
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
fn make_session_with_usage(
|
||||
total_tokens: Option<i32>,
|
||||
input_tokens: Option<i32>,
|
||||
|
||||
@@ -45,8 +45,8 @@ use crate::oauth::oauth_flow;
|
||||
use crate::prompt_template;
|
||||
use crate::subprocess::configure_subprocess;
|
||||
use rmcp::model::{
|
||||
CallToolRequestParams, Content, ErrorCode, ErrorData, GetPromptResult, Prompt, Resource,
|
||||
ResourceContents, ServerInfo, Tool,
|
||||
CallToolRequestParams, CallToolResult, Content, ErrorCode, ErrorData, GetPromptResult, Meta,
|
||||
Prompt, Resource, ResourceContents, ServerInfo, Tool,
|
||||
};
|
||||
use rmcp::transport::auth::AuthClient;
|
||||
use schemars::_private::NoSerialize;
|
||||
@@ -121,6 +121,22 @@ pub struct ExtensionManagerCapabilities {
|
||||
pub host_info: Option<GooseMcpHostInfo>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct GooseMcpAppToolAttachment {
|
||||
pub tool_name: String,
|
||||
pub extension_name: String,
|
||||
pub resource_uri: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tool_meta: Option<Value>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resource_result: Option<Value>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub read_error: Option<String>,
|
||||
}
|
||||
|
||||
pub(crate) const TRUSTED_TOOL_UPDATE_META_KEY: &str = "__goose_tool_update_meta";
|
||||
|
||||
/// Manages goose extensions / MCP clients and their interactions
|
||||
pub struct ExtensionManager {
|
||||
extensions: Mutex<HashMap<String, Extension>>,
|
||||
@@ -214,6 +230,68 @@ pub fn get_tool_owner(tool: &Tool) -> Option<String> {
|
||||
.map(|s| s.to_string())
|
||||
}
|
||||
|
||||
fn get_tool_meta_value(tool: &Tool) -> Option<Value> {
|
||||
tool.meta.as_ref().map(|meta| Value::Object(meta.0.clone()))
|
||||
}
|
||||
|
||||
fn get_tool_resource_uri(tool: &Tool) -> Option<String> {
|
||||
tool.meta
|
||||
.as_ref()
|
||||
.and_then(|meta| meta.0.get("ui"))
|
||||
.and_then(Value::as_object)
|
||||
.and_then(|ui| ui.get("resourceUri"))
|
||||
.and_then(Value::as_str)
|
||||
.map(ToString::to_string)
|
||||
}
|
||||
|
||||
fn remove_untrusted_mcp_app_meta(result: &mut CallToolResult) {
|
||||
let Some(meta) = result.meta.as_mut() else {
|
||||
return;
|
||||
};
|
||||
|
||||
meta.0.remove(TRUSTED_TOOL_UPDATE_META_KEY);
|
||||
|
||||
let remove_goose = meta
|
||||
.0
|
||||
.get_mut("goose")
|
||||
.and_then(Value::as_object_mut)
|
||||
.map(|goose_meta| {
|
||||
goose_meta.remove("mcpApp");
|
||||
goose_meta.is_empty()
|
||||
})
|
||||
.unwrap_or(false);
|
||||
|
||||
if remove_goose {
|
||||
meta.0.remove("goose");
|
||||
}
|
||||
|
||||
if meta.0.is_empty() {
|
||||
result.meta = None;
|
||||
}
|
||||
}
|
||||
|
||||
fn insert_trusted_tool_update_meta(
|
||||
result: &mut CallToolResult,
|
||||
attachment: &GooseMcpAppToolAttachment,
|
||||
) {
|
||||
let Ok(attachment_value) = serde_json::to_value(attachment) else {
|
||||
return;
|
||||
};
|
||||
|
||||
let mut meta_map = result
|
||||
.meta
|
||||
.as_ref()
|
||||
.map(|meta| meta.0.clone())
|
||||
.unwrap_or_default();
|
||||
let mut trusted_meta = serde_json::Map::new();
|
||||
trusted_meta.insert("mcpApp".to_string(), attachment_value);
|
||||
meta_map.insert(
|
||||
TRUSTED_TOOL_UPDATE_META_KEY.to_string(),
|
||||
Value::Object(trusted_meta),
|
||||
);
|
||||
result.meta = Some(Meta(meta_map));
|
||||
}
|
||||
|
||||
fn is_unprefixed_extension(config: &ExtensionConfig) -> bool {
|
||||
match config {
|
||||
ExtensionConfig::Platform { name, .. } | ExtensionConfig::Builtin { name, .. } => {
|
||||
@@ -241,9 +319,12 @@ pub fn is_hidden_extension(name: &str) -> bool {
|
||||
|
||||
/// Result of resolving a tool call to its owning extension
|
||||
struct ResolvedTool {
|
||||
tool_name: String,
|
||||
extension_name: String,
|
||||
actual_tool_name: String,
|
||||
client: McpClientBox,
|
||||
tool_meta: Option<Value>,
|
||||
resource_uri: Option<String>,
|
||||
}
|
||||
|
||||
async fn child_process_client(
|
||||
@@ -1063,6 +1144,48 @@ impl ExtensionManager {
|
||||
Ok(tools)
|
||||
}
|
||||
|
||||
fn host_supports_mcp_apps(&self) -> bool {
|
||||
if let Some(host_info) = &self.capabilities.host_info {
|
||||
if host_info.explicit_extensions {
|
||||
return host_info.mcpui_enabled();
|
||||
}
|
||||
}
|
||||
|
||||
self.capabilities.mcpui
|
||||
}
|
||||
|
||||
async fn hydrate_mcp_app_attachment(
|
||||
client: &McpClientBox,
|
||||
session_id: &str,
|
||||
resolved_tool: &ResolvedTool,
|
||||
cancellation_token: CancellationToken,
|
||||
) -> Option<GooseMcpAppToolAttachment> {
|
||||
let resource_uri = resolved_tool.resource_uri.clone()?;
|
||||
|
||||
let mut attachment = GooseMcpAppToolAttachment {
|
||||
tool_name: resolved_tool.tool_name.clone(),
|
||||
extension_name: resolved_tool.extension_name.clone(),
|
||||
resource_uri: resource_uri.clone(),
|
||||
tool_meta: resolved_tool.tool_meta.clone(),
|
||||
resource_result: None,
|
||||
read_error: None,
|
||||
};
|
||||
|
||||
match client
|
||||
.read_resource(session_id, &resource_uri, cancellation_token)
|
||||
.await
|
||||
{
|
||||
Ok(resource_result) => {
|
||||
attachment.resource_result = serde_json::to_value(&resource_result).ok();
|
||||
}
|
||||
Err(error) => {
|
||||
attachment.read_error = Some(error.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
Some(attachment)
|
||||
}
|
||||
|
||||
async fn invalidate_tools_cache_and_bump_version(&self) {
|
||||
self.tools_cache_version.fetch_add(1, Ordering::SeqCst);
|
||||
*self.tools_cache.lock().await = None;
|
||||
@@ -1432,17 +1555,6 @@ impl ExtensionManager {
|
||||
session_id: &str,
|
||||
tool_name: &str,
|
||||
) -> Result<ResolvedTool, ErrorData> {
|
||||
if let Some((prefix, actual)) = tool_name.split_once("__") {
|
||||
let owner = name_to_key(prefix);
|
||||
if let Some(client) = self.get_server_client(&owner).await {
|
||||
return Ok(ResolvedTool {
|
||||
extension_name: owner,
|
||||
actual_tool_name: actual.to_string(),
|
||||
client,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let tools = self.get_all_tools_cached(session_id).await.map_err(|e| {
|
||||
ErrorData::new(
|
||||
ErrorCode::INTERNAL_ERROR,
|
||||
@@ -1452,13 +1564,19 @@ impl ExtensionManager {
|
||||
})?;
|
||||
|
||||
if let Some(tool) = tools.iter().find(|t| *t.name == *tool_name) {
|
||||
let owner = get_tool_owner(tool).ok_or_else(|| {
|
||||
ErrorData::new(
|
||||
ErrorCode::RESOURCE_NOT_FOUND,
|
||||
format!("Tool '{}' has no owner", tool_name),
|
||||
None,
|
||||
)
|
||||
})?;
|
||||
let owner = get_tool_owner(tool)
|
||||
.or_else(|| {
|
||||
tool_name
|
||||
.split_once("__")
|
||||
.map(|(prefix, _)| name_to_key(prefix))
|
||||
})
|
||||
.ok_or_else(|| {
|
||||
ErrorData::new(
|
||||
ErrorCode::RESOURCE_NOT_FOUND,
|
||||
format!("Tool '{}' has no owner", tool_name),
|
||||
None,
|
||||
)
|
||||
})?;
|
||||
|
||||
let actual_tool_name = tool_name
|
||||
.strip_prefix(&format!("{owner}__"))
|
||||
@@ -1474,12 +1592,29 @@ impl ExtensionManager {
|
||||
})?;
|
||||
|
||||
return Ok(ResolvedTool {
|
||||
tool_name: tool.name.to_string(),
|
||||
extension_name: owner,
|
||||
actual_tool_name,
|
||||
client,
|
||||
tool_meta: get_tool_meta_value(tool),
|
||||
resource_uri: get_tool_resource_uri(tool),
|
||||
});
|
||||
}
|
||||
|
||||
if let Some((prefix, actual)) = tool_name.split_once("__") {
|
||||
let owner = name_to_key(prefix);
|
||||
if let Some(client) = self.get_server_client(&owner).await {
|
||||
return Ok(ResolvedTool {
|
||||
tool_name: tool_name.to_string(),
|
||||
extension_name: owner,
|
||||
actual_tool_name: actual.to_string(),
|
||||
client,
|
||||
tool_meta: None,
|
||||
resource_uri: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Err(ErrorData::new(
|
||||
ErrorCode::RESOURCE_NOT_FOUND,
|
||||
format!("Tool '{}' not found", tool_name),
|
||||
@@ -1515,8 +1650,13 @@ impl ExtensionManager {
|
||||
|
||||
let arguments = tool_call.arguments.clone();
|
||||
let client = resolved.client.clone();
|
||||
let hydration_client = client.clone();
|
||||
let notifications_receiver = client.subscribe().await;
|
||||
let actual_tool_name = resolved.actual_tool_name;
|
||||
let actual_tool_name = resolved.actual_tool_name.clone();
|
||||
let resolved_tool = resolved;
|
||||
let should_hydrate_mcp_app = self.host_supports_mcp_apps();
|
||||
let read_cancellation_token = cancellation_token.clone();
|
||||
let session_id = ctx.session_id.clone();
|
||||
let owned_ctx = ToolCallContext::new(
|
||||
ctx.session_id.clone(),
|
||||
ctx.working_dir.clone(),
|
||||
@@ -1530,7 +1670,7 @@ impl ExtensionManager {
|
||||
owned_ctx.session_id,
|
||||
owned_ctx.working_dir,
|
||||
);
|
||||
client
|
||||
let mut result = client
|
||||
.call_tool(&owned_ctx, &actual_tool_name, arguments, cancellation_token)
|
||||
.await
|
||||
.map_err(|e| match e {
|
||||
@@ -1538,7 +1678,24 @@ impl ExtensionManager {
|
||||
_ => {
|
||||
ErrorData::new(ErrorCode::INTERNAL_ERROR, e.to_string(), e.maybe_to_value())
|
||||
}
|
||||
})
|
||||
})?;
|
||||
|
||||
remove_untrusted_mcp_app_meta(&mut result);
|
||||
|
||||
if should_hydrate_mcp_app && result.is_error != Some(true) {
|
||||
if let Some(attachment) = Self::hydrate_mcp_app_attachment(
|
||||
&hydration_client,
|
||||
&session_id,
|
||||
&resolved_tool,
|
||||
read_cancellation_token,
|
||||
)
|
||||
.await
|
||||
{
|
||||
insert_trusted_tool_update_meta(&mut result, &attachment);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(result)
|
||||
};
|
||||
|
||||
Ok(ToolCallResult {
|
||||
@@ -2318,6 +2475,80 @@ mod tests {
|
||||
assert!(!tool_names.iter().any(|n| n.starts_with("ext_b__")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_remove_untrusted_mcp_app_meta_strips_spoofed_payload() {
|
||||
let mut result = CallToolResult::success(vec![]);
|
||||
result.meta = Some(Meta(
|
||||
serde_json::from_value(serde_json::json!({
|
||||
"goose": {
|
||||
"mcpApp": {
|
||||
"resourceUri": "ui://spoofed/app",
|
||||
},
|
||||
"other": true,
|
||||
},
|
||||
TRUSTED_TOOL_UPDATE_META_KEY: {
|
||||
"mcpApp": {
|
||||
"resourceUri": "ui://spoofed/internal",
|
||||
},
|
||||
},
|
||||
}))
|
||||
.unwrap(),
|
||||
));
|
||||
|
||||
remove_untrusted_mcp_app_meta(&mut result);
|
||||
|
||||
let meta = result.meta.expect("expected remaining meta");
|
||||
assert_eq!(meta.0.get(TRUSTED_TOOL_UPDATE_META_KEY), None);
|
||||
assert_eq!(
|
||||
meta.0.get("goose"),
|
||||
Some(&serde_json::json!({ "other": true }))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_insert_trusted_tool_update_meta_stores_backend_payload() {
|
||||
let mut result = CallToolResult::success(vec![]);
|
||||
let attachment = GooseMcpAppToolAttachment {
|
||||
tool_name: "weather__render".to_string(),
|
||||
extension_name: "weather".to_string(),
|
||||
resource_uri: "ui://weather/app".to_string(),
|
||||
tool_meta: None,
|
||||
resource_result: Some(serde_json::json!({
|
||||
"contents": [
|
||||
{
|
||||
"uri": "ui://weather/app",
|
||||
"mimeType": "text/html;profile=mcp-app",
|
||||
"text": "<div>Hello</div>",
|
||||
},
|
||||
],
|
||||
})),
|
||||
read_error: None,
|
||||
};
|
||||
|
||||
insert_trusted_tool_update_meta(&mut result, &attachment);
|
||||
|
||||
let meta = result.meta.expect("expected trusted meta");
|
||||
assert_eq!(
|
||||
meta.0.get(TRUSTED_TOOL_UPDATE_META_KEY),
|
||||
Some(&serde_json::json!({
|
||||
"mcpApp": {
|
||||
"toolName": "weather__render",
|
||||
"extensionName": "weather",
|
||||
"resourceUri": "ui://weather/app",
|
||||
"resourceResult": {
|
||||
"contents": [
|
||||
{
|
||||
"uri": "ui://weather/app",
|
||||
"mimeType": "text/html;profile=mcp-app",
|
||||
"text": "<div>Hello</div>",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_add_extension_noop_on_identical_config() {
|
||||
// When add_extension is called with a config that is byte-for-byte identical to
|
||||
|
||||
@@ -7,6 +7,8 @@ STDERR: time=2025-12-11T17:58:47.640-05:00 level=INFO msg="server session connec
|
||||
STDOUT: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"completions":{},"logging":{},"prompts":{"listChanged":true},"resources":{"listChanged":true},"tools":{"listChanged":true}},"instructions":"The GitHub MCP Server provides tools to interact with GitHub platform.\n\nTool selection guidance:\n\t1. Use 'list_*' tools for broad, simple retrieval and pagination of all items of a type (e.g., all issues, all PRs, all branches) with basic filtering.\n\t2. Use 'search_*' tools for targeted queries with specific criteria, keywords, or complex filters (e.g., issues with certain text, PRs by author, code containing functions).\n\nContext management:\n\t1. Use pagination whenever possible with batches of 5-10 items.\n\t2. Use minimal_output parameter set to true if the full information is not needed to accomplish a task.\n\nTool usage guidance:\n\t1. For 'search_*' tools: Use separate 'sort' and 'order' parameters if available for sorting results - do not include 'sort:' syntax in query strings. Query strings should contain only search criteria (e.g., 'org:google language:python'), not sorting instructions. Always call 'get_me' first to understand current user permissions and context. ## Issues\n\nCheck 'list_issue_types' first for organizations to use proper issue types. Use 'search_issues' before creating new issues to avoid duplicates. Always set 'state_reason' when closing issues. ## Pull Requests\n\nPR review workflow: Always use 'pull_request_review_write' with method 'create' to create a pending review, then 'add_comment_to_pending_review' to add comments, and finally 'pull_request_review_write' with method 'submit_pending' to submit the review for complex reviews with line-specific comments.\n\nBefore creating a pull request, search for pull request templates in the repository. Template files are called pull_request_template.md or they're located in '.github/PULL_REQUEST_TEMPLATE' directory. Use the template content to structure the PR description and then call create_pull_request tool.","protocolVersion":"2025-03-26","serverInfo":{"name":"github-mcp-server","title":"GitHub MCP Server","version":"0.24.1"}}}
|
||||
STDIN: {"jsonrpc":"2.0","method":"notifications/initialized"}
|
||||
STDERR: time=2025-12-11T17:58:47.642-05:00 level=INFO msg="session initialized"
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0},"name":"get_file_contents","arguments":{"owner":"block","path":"README.md","repo":"goose","sha":"ab62b863c1666232a67048b6c4e10007a2a5b83c"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"successfully downloaded text file (SHA: de9bdde7f260549bf3a083651842f30ab29cf4e9)"},{"type":"resource","resource":{"uri":"repo://block/goose/sha/ab62b863c1666232a67048b6c4e10007a2a5b83c/contents/README.md","mimeType":"text/plain; charset=utf-8","text":"\u003cdiv align=\"center\"\u003e\n\n# goose\n\n_a local, extensible, open source AI agent that automates engineering tasks_\n\n\u003cp align=\"center\"\u003e\n \u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\n \u003cimg src=\"https://img.shields.io/badge/License-Apache_2.0-blue.svg\"\u003e\n \u003c/a\u003e\n \u003ca href=\"https://discord.gg/7GaTvbDwga\"\u003e\n \u003cimg src=\"https://img.shields.io/discord/1287729918100246654?logo=discord\u0026logoColor=white\u0026label=Join+Us\u0026color=blueviolet\" alt=\"Discord\"\u003e\n \u003c/a\u003e\n \u003ca href=\"https://github.com/block/goose/actions/workflows/ci.yml\"\u003e\n \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/block/goose/ci.yml?branch=main\" alt=\"CI\"\u003e\n \u003c/a\u003e\n\u003c/p\u003e\n\u003c/div\u003e\n\ngoose is your on-machine AI agent, capable of automating complex development tasks from start to finish. More than just code suggestions, goose can build entire projects from scratch, write and execute code, debug failures, orchestrate workflows, and interact with external APIs - _autonomously_.\n\nWhether you're prototyping an idea, refining existing code, or managing intricate engineering pipelines, goose adapts to your workflow and executes tasks with precision.\n\nDesigned for maximum flexibility, goose works with any LLM and supports multi-model configuration to optimize performance and cost, seamlessly integrates with MCP servers, and is available as both a desktop app as well as CLI - making it the ultimate AI assistant for developers who want to move faster and focus on innovation.\n\n[](https://youtu.be/D-DpDunrbpo)\n\n# Quick Links\n- [Quickstart](https://goose-docs.ai/docs/quickstart)\n- [Installation](https://goose-docs.ai/docs/getting-started/installation)\n- [Tutorials](https://goose-docs.ai/docs/category/tutorials)\n- [Documentation](https://goose-docs.ai/docs/category/getting-started)\n\n\n# a little goose humor 🦢\n\n\u003e Why did the developer choose goose as their AI agent?\n\u003e \n\u003e Because it always helps them \"migrate\" their code to production! 🚀\n\n# goose around with us\n- [Discord](https://discord.gg/block-opensource)\n- [YouTube](https://www.youtube.com/@goose-oss)\n- [LinkedIn](https://www.linkedin.com/company/goose-oss)\n- [Twitter/X](https://x.com/goose_oss)\n- [Bluesky](https://bsky.app/profile/opensource.block.xyz)\n- [Nostr](https://njump.me/opensource@block.xyz)\n"}}]}}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"tools":[{"name":"get_file_contents","description":"Get file contents from GitHub","inputSchema":{"type":"object","properties":{"owner":{"type":"string"},"repo":{"type":"string"},"path":{"type":"string"},"sha":{"type":"string"}},"required":["owner","repo","path"]}}]}}
|
||||
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":1},"name":"get_file_contents","arguments":{"owner":"block","path":"README.md","repo":"goose","sha":"ab62b863c1666232a67048b6c4e10007a2a5b83c"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"successfully downloaded text file (SHA: de9bdde7f260549bf3a083651842f30ab29cf4e9)"},{"type":"resource","resource":{"uri":"repo://block/goose/sha/ab62b863c1666232a67048b6c4e10007a2a5b83c/contents/README.md","mimeType":"text/plain; charset=utf-8","text":"\u003cdiv align=\"center\"\u003e\n\n# goose\n\n_a local, extensible, open source AI agent that automates engineering tasks_\n\n\u003cp align=\"center\"\u003e\n \u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\n \u003cimg src=\"https://img.shields.io/badge/License-Apache_2.0-blue.svg\"\u003e\n \u003c/a\u003e\n \u003ca href=\"https://discord.gg/7GaTvbDwga\"\u003e\n \u003cimg src=\"https://img.shields.io/discord/1287729918100246654?logo=discord\u0026logoColor=white\u0026label=Join+Us\u0026color=blueviolet\" alt=\"Discord\"\u003e\n \u003c/a\u003e\n \u003ca href=\"https://github.com/block/goose/actions/workflows/ci.yml\"\u003e\n \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/block/goose/ci.yml?branch=main\" alt=\"CI\"\u003e\n \u003c/a\u003e\n\u003c/p\u003e\n\u003c/div\u003e\n\ngoose is your on-machine AI agent, capable of automating complex development tasks from start to finish. More than just code suggestions, goose can build entire projects from scratch, write and execute code, debug failures, orchestrate workflows, and interact with external APIs - _autonomously_.\n\nWhether you're prototyping an idea, refining existing code, or managing intricate engineering pipelines, goose adapts to your workflow and executes tasks with precision.\n\nDesigned for maximum flexibility, goose works with any LLM and supports multi-model configuration to optimize performance and cost, seamlessly integrates with MCP servers, and is available as both a desktop app as well as CLI - making it the ultimate AI assistant for developers who want to move faster and focus on innovation.\n\n[](https://youtu.be/D-DpDunrbpo)\n\n# Quick Links\n- [Quickstart](https://goose-docs.ai/docs/quickstart)\n- [Installation](https://goose-docs.ai/docs/getting-started/installation)\n- [Tutorials](https://goose-docs.ai/docs/category/tutorials)\n- [Documentation](https://goose-docs.ai/docs/category/getting-started)\n\n\n# a little goose humor 🦢\n\n\u003e Why did the developer choose goose as their AI agent?\n\u003e \n\u003e Because it always helps them \"migrate\" their code to production! 🚀\n\n# goose around with us\n- [Discord](https://discord.gg/block-opensource)\n- [YouTube](https://www.youtube.com/@goose-oss)\n- [LinkedIn](https://www.linkedin.com/company/goose-oss)\n- [Twitter/X](https://x.com/goose_oss)\n- [Bluesky](https://bsky.app/profile/opensource.block.xyz)\n- [Nostr](https://njump.me/opensource@block.xyz)\n"}}]}}
|
||||
STDERR: time=2025-12-11T17:58:48.133-05:00 level=INFO msg="server session disconnected" session_id=""
|
||||
|
||||
+17
-15
@@ -4,20 +4,22 @@ STDOUT: {"result":{"protocolVersion":"2025-03-26","capabilities":{"tools":{"list
|
||||
STDIN: {"jsonrpc":"2.0","method":"notifications/initialized"}
|
||||
STDOUT: {"method":"notifications/tools/list_changed","jsonrpc":"2.0"}
|
||||
STDOUT: {"method":"notifications/tools/list_changed","jsonrpc":"2.0"}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0},"name":"echo","arguments":{"message":"Hello, world!"}}}
|
||||
STDOUT: {"result":{"content":[{"type":"text","text":"Echo: Hello, world!"}]},"jsonrpc":"2.0","id":1}
|
||||
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":1},"name":"get-sum","arguments":{"a":1,"b":2}}}
|
||||
STDOUT: {"result":{"content":[{"type":"text","text":"The sum of 1 and 2 is 3."}]},"jsonrpc":"2.0","id":2}
|
||||
STDIN: {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":2},"name":"trigger-long-running-operation","arguments":{"duration":1,"steps":5}}}
|
||||
STDOUT: {"method":"notifications/progress","params":{"progress":1,"total":5,"progressToken":2},"jsonrpc":"2.0"}
|
||||
STDOUT: {"method":"notifications/progress","params":{"progress":2,"total":5,"progressToken":2},"jsonrpc":"2.0"}
|
||||
STDOUT: {"method":"notifications/progress","params":{"progress":3,"total":5,"progressToken":2},"jsonrpc":"2.0"}
|
||||
STDOUT: {"method":"notifications/progress","params":{"progress":4,"total":5,"progressToken":2},"jsonrpc":"2.0"}
|
||||
STDOUT: {"method":"notifications/progress","params":{"progress":5,"total":5,"progressToken":2},"jsonrpc":"2.0"}
|
||||
STDOUT: {"result":{"content":[{"type":"text","text":"Long running operation completed. Duration: 1 seconds, Steps: 5."}]},"jsonrpc":"2.0","id":3}
|
||||
STDIN: {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":3},"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":4}
|
||||
STDIN: {"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":4},"name":"trigger-sampling-request","arguments":{"maxTokens":100,"prompt":"Please provide a quote from The Great Gatsby"}}}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"tools":[{"name":"echo","description":"Echo a message","inputSchema":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}},{"name":"get-sum","description":"Get the sum of two numbers","inputSchema":{"type":"object","properties":{"a":{"type":"number"},"b":{"type":"number"}},"required":["a","b"]}},{"name":"trigger-long-running-operation","description":"Trigger a long-running operation","inputSchema":{"type":"object","properties":{"duration":{"type":"number"},"steps":{"type":"number"}},"required":["duration","steps"]}},{"name":"get-structured-content","description":"Get structured content","inputSchema":{"type":"object","properties":{"location":{"type":"string"}},"required":["location"]}},{"name":"trigger-sampling-request","description":"Trigger a sampling request","inputSchema":{"type":"object","properties":{"prompt":{"type":"string"},"maxTokens":{"type":"number"}},"required":["prompt","maxTokens"]}}]}}
|
||||
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":1},"name":"echo","arguments":{"message":"Hello, world!"}}}
|
||||
STDOUT: {"result":{"content":[{"type":"text","text":"Echo: Hello, world!"}]},"jsonrpc":"2.0","id":2}
|
||||
STDIN: {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":2},"name":"get-sum","arguments":{"a":1,"b":2}}}
|
||||
STDOUT: {"result":{"content":[{"type":"text","text":"The sum of 1 and 2 is 3."}]},"jsonrpc":"2.0","id":3}
|
||||
STDIN: {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":3},"name":"trigger-long-running-operation","arguments":{"duration":1,"steps":5}}}
|
||||
STDOUT: {"method":"notifications/progress","params":{"progress":1,"total":5,"progressToken":3},"jsonrpc":"2.0"}
|
||||
STDOUT: {"method":"notifications/progress","params":{"progress":2,"total":5,"progressToken":3},"jsonrpc":"2.0"}
|
||||
STDOUT: {"method":"notifications/progress","params":{"progress":3,"total":5,"progressToken":3},"jsonrpc":"2.0"}
|
||||
STDOUT: {"method":"notifications/progress","params":{"progress":4,"total":5,"progressToken":3},"jsonrpc":"2.0"}
|
||||
STDOUT: {"method":"notifications/progress","params":{"progress":5,"total":5,"progressToken":3},"jsonrpc":"2.0"}
|
||||
STDOUT: {"result":{"content":[{"type":"text","text":"Long running operation completed. Duration: 1 seconds, Steps: 5."}]},"jsonrpc":"2.0","id":4}
|
||||
STDIN: {"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":4},"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":5}
|
||||
STDIN: {"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":5},"name":"trigger-sampling-request","arguments":{"maxTokens":100,"prompt":"Please provide a quote from The Great Gatsby"}}}
|
||||
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":0}
|
||||
STDIN: {"jsonrpc":"2.0","id":0,"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":5}
|
||||
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":6}
|
||||
|
||||
+4
-2
@@ -25,5 +25,7 @@ STDERR: [01/23/26 15:56:13] INFO Starting MCP server 'mymcp' with server
|
||||
STDERR: transport 'stdio'
|
||||
STDOUT: {"jsonrpc":"2.0","id":0,"result":{"protocolVersion":"2025-03-26","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":1,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0},"name":"divide","arguments":{"dividend":10,"divisor":2}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"5.0"}],"structuredContent":{"result":5.0},"isError":false}}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"tools":[{"name":"divide","description":"Divide two numbers","inputSchema":{"type":"object","properties":{"dividend":{"type":"number"},"divisor":{"type":"number"}},"required":["dividend","divisor"]}}]}}
|
||||
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":1},"name":"divide","arguments":{"dividend":10,"divisor":2}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"5.0"}],"structuredContent":{"result":5.0},"isError":false}}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
STDIN: {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{"elicitation":{},"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}},"roots": {},"sampling":{}},"clientInfo":{"name":"goose-desktop","version":"0.0.0"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":0,"result":{"protocolVersion":"2025-03-26","capabilities":{"experimental":{},"prompts":{"listChanged":false},"tools":{"listChanged":false}},"serverInfo":{"name":"mcp-fetch","version":"1.25.0"}}}
|
||||
STDIN: {"jsonrpc":"2.0","method":"notifications/initialized"}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0},"name":"fetch","arguments":{"url":"https://example.com"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"Contents of https://example.com/:\nThis domain is for use in documentation examples without needing permission. Avoid use in operations.\n\n[Learn more](https://iana.org/domains/example)"}],"isError":false}}
|
||||
STDIN: {"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":0}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":1,"result":{"tools":[{"name":"fetch","description":"Fetch a URL","inputSchema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}}]}}
|
||||
STDIN: {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"_meta":{"agent-session-id":"test-session-id","progressToken":1},"name":"fetch","arguments":{"url":"https://example.com"}}}
|
||||
STDOUT: {"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"Contents of https://example.com/:\nThis domain is for use in documentation examples without needing permission. Avoid use in operations.\n\n[Learn more](https://iana.org/domains/example)"}],"isError":false}}
|
||||
|
||||
Reference in New Issue
Block a user