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
34 changes: 18 additions & 16 deletions crates/goose-cli/src/commands/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ use goose::config::{
};
use goose::message::Message;
use goose::providers::{create, providers};
use mcp_core::tool::ToolAnnotations;
use mcp_core::Tool;
use serde_json::{json, Value};
use rmcp::model::{Tool, ToolAnnotations};
use rmcp::object;
use serde_json::Value;
use std::collections::HashMap;
use std::error::Error;

Expand Down Expand Up @@ -387,21 +387,21 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
let sample_tool = Tool::new(
"get_weather".to_string(),
"Get current temperature for a given location.".to_string(),
json!({
object!({
"type": "object",
"required": ["location"],
"properties": {
"location": {"type": "string"}
}
}),
Some(ToolAnnotations {
title: Some("Get weather".to_string()),
read_only_hint: true,
destructive_hint: false,
idempotent_hint: false,
open_world_hint: false,
}),
);
)
.annotate(ToolAnnotations {
title: Some("Get weather".to_string()),
read_only_hint: Some(true),
destructive_hint: Some(false),
idempotent_hint: Some(false),
open_world_hint: Some(false),
});
vec![sample_tool]
} else {
vec![]
Expand All @@ -411,9 +411,8 @@ pub async fn configure_provider_dialog() -> Result<bool, Box<dyn Error>> {
.complete(
"You are an AI agent called Goose. You use tools of connected extensions to solve problems.",
&messages,
&tools
)
.await;
&tools.into_iter().collect::<Vec<_>>()
).await;

match result {
Ok((_message, _usage)) => {
Expand Down Expand Up @@ -1270,7 +1269,10 @@ pub async fn configure_tool_permissions_dialog() -> Result<(), Box<dyn Error>> {
.map(|tool| {
ToolInfo::new(
&tool.name,
&tool.description,
tool.description
.as_ref()
.map(|d| d.as_ref())
.unwrap_or_default(),
get_parameter_names(&tool),
permission_manager.get_user_permission(&tool.name),
)
Expand Down
59 changes: 28 additions & 31 deletions crates/goose-mcp/src/computercontroller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use base64::Engine;
use etcetera::{choose_app_strategy, AppStrategy};
use indoc::{formatdoc, indoc};
use reqwest::{Client, Url};
use serde_json::{json, Value};
use serde_json::Value;
use std::{
collections::HashMap, fs, future::Future, path::PathBuf, pin::Pin, sync::Arc, sync::Mutex,
};
Expand All @@ -14,11 +14,13 @@ use std::os::unix::fs::PermissionsExt;
use mcp_core::{
handler::{PromptError, ResourceError, ToolError},
protocol::ServerCapabilities,
tool::{Tool, ToolAnnotations},
};
use mcp_server::router::CapabilitiesBuilder;
use mcp_server::Router;
use rmcp::model::{AnnotateAble, Content, JsonRpcMessage, Prompt, RawResource, Resource};
use rmcp::model::{
AnnotateAble, Content, JsonRpcMessage, Prompt, RawResource, Resource, Tool, ToolAnnotations,
};
use rmcp::object;

mod docx_tool;
mod pdf_tool;
Expand Down Expand Up @@ -58,7 +60,7 @@ impl ComputerControllerRouter {
The content is cached locally and can be accessed later using the cache_path
returned in the response.
"#},
json!({
object!({
"type": "object",
"required": ["url"],
"properties": {
Expand All @@ -74,14 +76,14 @@ impl ComputerControllerRouter {
}
}
}),
Some(ToolAnnotations {
title: Some("Web Scrape".to_string()),
read_only_hint: true,
destructive_hint: false,
idempotent_hint: false,
open_world_hint: true,
}),
);
)
.annotate(ToolAnnotations {
title: Some("Web Scrape".to_string()),
read_only_hint: Some(true),
destructive_hint: Some(false),
idempotent_hint: Some(false),
open_world_hint: Some(true),
});

let computer_control_desc = match std::env::consts::OS {
"windows" => indoc! {r#"
Expand Down Expand Up @@ -131,7 +133,7 @@ impl ComputerControllerRouter {
let computer_control_tool = Tool::new(
"computer_control",
computer_control_desc.to_string(),
json!({
object!({
"type": "object",
"required": ["script"],
"properties": {
Expand All @@ -146,7 +148,6 @@ impl ComputerControllerRouter {
}
}
}),
None,
);

let quick_script_desc = match std::env::consts::OS {
Expand Down Expand Up @@ -177,7 +178,7 @@ impl ComputerControllerRouter {
let quick_script_tool = Tool::new(
"automation_script",
quick_script_desc.to_string(),
json!({
object!({
"type": "object",
"required": ["language", "script"],
"properties": {
Expand All @@ -197,7 +198,6 @@ impl ComputerControllerRouter {
}
}
}),
None,
);

let cache_tool = Tool::new(
Expand All @@ -209,7 +209,7 @@ impl ComputerControllerRouter {
- delete: Delete a cached file
- clear: Clear all cached files
"#},
json!({
object!({
"type": "object",
"required": ["command"],
"properties": {
Expand All @@ -224,7 +224,6 @@ impl ComputerControllerRouter {
}
}
}),
None,
);

let pdf_tool = Tool::new(
Expand All @@ -237,7 +236,7 @@ impl ComputerControllerRouter {

Use this when there is a .pdf file or files that need to be processed.
"#},
json!({
object!({
"type": "object",
"required": ["path", "operation"],
"properties": {
Expand All @@ -252,14 +251,14 @@ impl ComputerControllerRouter {
}
}
}),
Some(ToolAnnotations {
title: Some("PDF process".to_string()),
read_only_hint: true,
destructive_hint: false,
idempotent_hint: true,
open_world_hint: false,
}),
);
)
.annotate(ToolAnnotations {
title: Some("PDF process".to_string()),
read_only_hint: Some(true),
destructive_hint: Some(false),
idempotent_hint: Some(true),
open_world_hint: Some(false),
});

let docx_tool = Tool::new(
"docx_tool",
Expand All @@ -276,7 +275,7 @@ impl ComputerControllerRouter {

Use this when there is a .docx file that needs to be processed or created.
"#},
json!({
object!({
"type": "object",
"required": ["path", "operation"],
"properties": {
Expand Down Expand Up @@ -357,7 +356,6 @@ impl ComputerControllerRouter {
}
}
}),
None,
);

let xlsx_tool = Tool::new(
Expand All @@ -375,7 +373,7 @@ impl ComputerControllerRouter {

Use this when working with Excel spreadsheets to analyze or modify data.
"#},
json!({
object!({
"type": "object",
"required": ["path", "operation"],
"properties": {
Expand Down Expand Up @@ -419,7 +417,6 @@ impl ComputerControllerRouter {
}
}
}),
None,
);

// choose_app_strategy().cache_dir()
Expand Down
Loading
Loading