Skip to content

Per-tool enable/disable selection in MCP server tool list #656

Closed

Description

@haiphucnguyen

Summary

Currently Askimo fetches all tools from every connected MCP server and forwards the entire list to the AI on every request. When an MCP server exposes many tools, this bloats the context window, increases cost, and may confuse the model with irrelevant options. Users should be able to select exactly which tools are active per MCP instance.

Image

Proposed Behavior

In the MCP Tools dialog (already accessible per instance), each tool row gets a toggle/checkbox. Only enabled tools are forwarded to the AI. Disabled tools are fetched and displayed in the UI but excluded from the tool context sent to the model.
By default, all tools are enabled (preserving current behavior).

Implementation Notes

The infrastructure is largely in place - this is a focused, well-scoped addition.

  1. Add enabled flag to ToolConfigData (McpInstanceService.kt)
private data class ToolConfigData(
    val toolName: String,
    val instanceId: String,
    val category: String,
    val strategy: Int,
    val autoInferred: Boolean = true,
    val updatedAt: LocalDateTime = LocalDateTime.now(),
    val approvalPolicy: ToolApprovalPolicy? = null,
    val enabled: Boolean = true,   // <-- add this
)
  1. Add setToolEnabled() to McpInstanceService
fun setToolEnabled(instanceId: String, toolName: String, enabled: Boolean) {
    val configs = loadToolConfigs().toMutableMap()
    val key = "$instanceId:$toolName"
    val existing = configs[key]
    configs[key] = (existing ?: ToolConfigData(...)).copy(
        enabled = enabled,
        autoInferred = false,
        updatedAt = LocalDateTime.now(),
    )
    saveGlobalToolConfigs(configs)
    invalidateCache()
}
  1. Filter in getGlobalTools()
    In fetchToolsFromInstance(), after building the ToolConfig list, filter by the persisted enabled flag:
// Only include tools the user has enabled (default: true)
.filter { userConfigs["${instance.id}:${it.specification.name()}"]?.enabled != false }
  1. Add a toggle to each tool row in McpToolsDialog.kt
    The dialog already renders a card per tool with toolApprovalPolicyControl. Add a Switch or Checkbox alongside it:
Row(
    modifier = Modifier.fillMaxWidth(),
    horizontalArrangement = Arrangement.SpaceBetween,
    verticalAlignment = Alignment.CenterVertically,
) {
    Text(
        text = stringResource("mcp.tool.enabled.label"),
        style = AppTextStyles.caption,
    )
    Switch(
        checked = tool.enabled,  // needs enabled field on ToolConfig too
        onCheckedChange = { enabled ->
            scope.launch(Dispatchers.IO) {
                mcpInstanceService.setToolEnabled(instance.id, tool.specification.name(), enabled)
                tools = tools?.map { t ->
                    if (t.specification.name() == tool.specification.name()) t.copy(enabled = enabled) else t
                }
            }
        },
    )
}

Note: ToolConfig (in shared) will also need an enabled: Boolean = true field so the UI state is carried through.

Activity

  1. added
    enhancement
    help wanted
    good first issue
    on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions