mirror of
https://github.com/RightNow-AI/openfang.git
synced 2026-07-30 15:01:15 +00:00
MCP guidance
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.0"
|
||||
version = "0.1.6"
|
||||
edition = "2021"
|
||||
license = "Apache-2.0 OR MIT"
|
||||
repository = "https://github.com/RightNow-AI/openfang"
|
||||
|
||||
@@ -4065,7 +4065,18 @@ impl OpenFangKernel {
|
||||
tool_names.join(", ")
|
||||
));
|
||||
}
|
||||
summary.push_str("MCP tools are prefixed with mcp_{server}_ and work like regular tools.");
|
||||
summary.push_str("MCP tools are prefixed with mcp_{server}_ and work like regular tools.\n");
|
||||
// Add filesystem-specific guidance when a filesystem MCP server is connected
|
||||
let has_filesystem = servers.keys().any(|s| s.contains("filesystem"));
|
||||
if has_filesystem {
|
||||
summary.push_str(
|
||||
"IMPORTANT: For accessing files OUTSIDE your workspace directory, you MUST use \
|
||||
the MCP filesystem tools (e.g. mcp_filesystem_read_file, mcp_filesystem_list_directory) \
|
||||
instead of the built-in file_read/file_list/file_write tools, which are restricted to \
|
||||
the workspace. The MCP filesystem server has been granted access to specific directories \
|
||||
by the user.",
|
||||
);
|
||||
}
|
||||
summary
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,11 @@ pub fn resolve_sandbox_path(user_path: &str, workspace_root: &Path) -> Result<Pa
|
||||
// Verify the canonical path is inside the workspace
|
||||
if !canon_candidate.starts_with(&canon_root) {
|
||||
return Err(format!(
|
||||
"Access denied: path '{}' resolves outside workspace",
|
||||
"Access denied: path '{}' resolves outside workspace. \
|
||||
If you have an MCP filesystem server configured, use the \
|
||||
mcp_filesystem_* tools (e.g. mcp_filesystem_read_file, \
|
||||
mcp_filesystem_list_directory) to access files outside \
|
||||
the workspace.",
|
||||
user_path
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user