Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 9, 2025

Overview

This PR addresses issue #XXX by adding a --disable-builtin-tools flag to the serve command, allowing users to disable all built-in tools and only expose loaded WebAssembly component tools through the MCP server.

Motivation

Some use cases require running Wassette with only custom component tools, without exposing the built-in management tools (load-component, unload-component, list-components, get-policy, permission management tools, etc.). This flag provides users with control over which tools are available through the MCP interface.

Changes

New Flag

  • Added --disable-builtin-tools boolean flag to the serve command
  • When enabled, all 12 built-in tools are hidden from the tools list and their invocation is blocked
  • When disabled (default), the server behaves exactly as before

Implementation Details

  • Updated McpServer struct to track the flag state
  • Modified handle_tools_list() to conditionally exclude builtin tools from the response
  • Modified handle_tools_call() to reject builtin tool invocations with a clear error message
  • Added is_builtin_tool() helper function to centralize builtin tool name checking

Built-in Tools Affected

When --disable-builtin-tools is set, the following tools are disabled:

  • load-component
  • unload-component
  • list-components
  • get-policy
  • grant-storage-permission
  • grant-network-permission
  • grant-environment-variable-permission
  • revoke-storage-permission
  • revoke-network-permission
  • revoke-environment-variable-permission
  • reset-permission
  • search-components

Testing

Added comprehensive integration test test_disable_builtin_tools that verifies:

  • Builtin tools are not included in the tools list when the flag is enabled
  • Attempts to call builtin tools return an appropriate error message
  • Component tools continue to work normally

Example Usage

# Disable builtin tools - only loaded components will be available
wassette serve --disable-builtin-tools

# Normal behavior (default) - builtin tools are available
wassette serve

Backward Compatibility

This change is fully backward compatible. The flag defaults to false, preserving existing behavior when not specified.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • example.com
    • Triggering command: /home/REDACTED/work/wassette/wassette/target/debug/deps/transport_integration_test-e0a05ef8810ed925 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Add a flag that can disable/enable these built in tools</issue_title>
<issue_description>We should probably have a flag that can disable/enable these built in tools. No need to do this now though</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #21

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Add flag to enable or disable built-in tools Add --disable-builtin-tools flag to disable built-in MCP tools Oct 9, 2025
Copilot finished work on behalf of Mossaka October 9, 2025 08:04
@Copilot Copilot AI requested a review from Mossaka October 9, 2025 08:04
@Mossaka Mossaka marked this pull request as ready for review October 9, 2025 08:20
@Mossaka Mossaka requested a review from Copilot October 10, 2025 23:26
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a --disable-builtin-tools flag to the serve command, allowing users to disable all built-in MCP management tools while keeping only loaded WebAssembly component tools available.

Key changes:

  • Added new command-line flag to disable 12 built-in management tools (load-component, unload-component, permissions management, etc.)
  • Modified server logic to conditionally exclude builtin tools from listings and reject their invocation when disabled
  • Added comprehensive integration test to verify the feature works correctly

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/commands.rs Added disable_builtin_tools boolean field to the Serve struct
src/main.rs Updated McpServer to track the flag state and pass it to tool handlers
src/config.rs Added default false value for the new flag in test configurations
crates/mcp-server/src/tools.rs Implemented core logic to filter builtin tools from listings and reject their calls
tests/transport_integration_test.rs Added integration test verifying builtin tools are properly disabled
CHANGELOG.md Documented the new feature addition

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +73 to 116
let result = if disable_builtin_tools && is_builtin_tool(req.name.as_ref()) {
// When builtin tools are disabled, reject calls to builtin tools
Err(anyhow::anyhow!("Built-in tools are disabled"))
} else {
// Handle builtin tools (if enabled) or component calls
match req.name.as_ref() {
"load-component" if !disable_builtin_tools => {
handle_load_component(&req, lifecycle_manager, server_peer).await
}
"unload-component" if !disable_builtin_tools => {
handle_unload_component(&req, lifecycle_manager, server_peer).await
}
"list-components" if !disable_builtin_tools => {
handle_list_components(lifecycle_manager).await
}
"get-policy" if !disable_builtin_tools => {
handle_get_policy(&req, lifecycle_manager).await
}
"grant-storage-permission" if !disable_builtin_tools => {
handle_grant_storage_permission(&req, lifecycle_manager).await
}
"grant-network-permission" if !disable_builtin_tools => {
handle_grant_network_permission(&req, lifecycle_manager).await
}
"grant-environment-variable-permission" if !disable_builtin_tools => {
handle_grant_environment_variable_permission(&req, lifecycle_manager).await
}
"revoke-storage-permission" if !disable_builtin_tools => {
handle_revoke_storage_permission(&req, lifecycle_manager).await
}
"revoke-network-permission" if !disable_builtin_tools => {
handle_revoke_network_permission(&req, lifecycle_manager).await
}
"revoke-environment-variable-permission" if !disable_builtin_tools => {
handle_revoke_environment_variable_permission(&req, lifecycle_manager).await
}
"search-components" if !disable_builtin_tools => {
handle_search_component(&req, lifecycle_manager).await
}
"reset-permission" if !disable_builtin_tools => {
handle_reset_permission(&req, lifecycle_manager).await
}
_ => handle_component_call(&req, lifecycle_manager).await,
}
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is duplicated - builtin tools are checked twice (first in the if condition, then in each match arm guard). Consider simplifying by removing the guards from the match arms since builtin tools are already handled in the outer if condition.

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Ok(())
}

#[test(tokio::test)]
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test attribute should be #[tokio::test] not #[test(tokio::test)]. The current syntax is incorrect and may not work as expected.

Copilot uses AI. Check for mistakes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

@Mossaka
Copy link
Collaborator

Mossaka commented Oct 13, 2025

@copilot please resolve all the comments

Copy link
Contributor Author

Copilot AI commented Oct 13, 2025

@copilot please resolve all the comments

I've verified that the PR is in good shape:

  • All tests pass (including the new test_disable_builtin_tools integration test)
  • No clippy warnings
  • Code is properly formatted
  • Build succeeds

Could you clarify which specific comments need to be resolved? I don't see any review comments or change requests in the current context. If there are specific issues or suggestions from code review, please point me to them so I can address them.

Copilot finished work on behalf of Mossaka October 13, 2025 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a flag that can disable/enable these built in tools

2 participants