MCP guidance

This commit is contained in:
jaberjaber23
2026-02-27 18:06:17 +03:00
parent 036cc14ad5
commit 51c1e154d9
3 changed files with 18 additions and 3 deletions
+1 -1
View File
@@ -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"
+12 -1
View File
@@ -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
));
}