Repository navigation
Description
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.
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.
- 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
)- 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()
}- 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 }- 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