From f5a06b158faedbf421659bce8025e8e81cda332d Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 2 Jun 2025 11:58:52 -0700 Subject: [PATCH 1/5] fix rules section border --- .../mainInput/Lump/sections/RulesSection.tsx | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx index fa9dff106..2e01157dc 100644 --- a/gui/src/components/mainInput/Lump/sections/RulesSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/RulesSection.tsx @@ -6,13 +6,12 @@ import { } from "@heroicons/react/24/outline"; import { RuleWithSource } from "core"; import { + DEFAULT_AGENT_SYSTEM_MESSAGE, + DEFAULT_AGENT_SYSTEM_MESSAGE_URL, DEFAULT_CHAT_SYSTEM_MESSAGE, DEFAULT_CHAT_SYSTEM_MESSAGE_URL, - DEFAULT_AGENT_SYSTEM_MESSAGE, - DEFAULT_AGENT_SYSTEM_MESSAGE_URL } from "core/llm/constructMessages"; import { useContext, useMemo } from "react"; -import { defaultBorderRadius, vscCommandCenterActiveBorder } from "../../.."; import { useAuth } from "../../../../context/Auth"; import { IdeMessengerContext } from "../../../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../../../redux/hooks"; @@ -91,13 +90,7 @@ const RuleCard: React.FC = ({ rule }) => { const smallFont = useFontSize(-2); const tinyFont = useFontSize(-3); return ( -
+
= ({ rule }) => { {" "} - {rule.source === "default-chat" || rule.source === "default-agent" ? ( + {rule.source === "default-chat" || + rule.source === "default-agent" ? ( @@ -195,24 +189,24 @@ export function RulesSection() { rules.unshift({ rule: config.selectedModelByRole.chat?.baseAgentSystemMessage, source: "model-agent-options", - }) + }); } else { rules.unshift({ rule: DEFAULT_AGENT_SYSTEM_MESSAGE, source: "default-agent", - }) + }); } } else { if (config.selectedModelByRole.chat?.baseChatSystemMessage) { rules.unshift({ rule: config.selectedModelByRole.chat?.baseChatSystemMessage, source: "model-chat-options", - }) + }); } else { rules.unshift({ rule: DEFAULT_CHAT_SYSTEM_MESSAGE, source: "default-chat", - }) + }); } } From 0f2cb9417cd760c234d54039c1d577cf15a1babf Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 4 Jun 2025 15:47:19 -0700 Subject: [PATCH 2/5] include mcp server names in tool names --- core/config/profile/doLoadConfig.ts | 4 +- core/index.d.ts | 1 + core/tools/mcpToolName.ts | 9 +++ core/tools/mcpToolName.vitest.ts | 57 +++++++++++++++++++ .../sections/tool-policies/ToolPolicyItem.tsx | 10 ++-- 5 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 core/tools/mcpToolName.ts create mode 100644 core/tools/mcpToolName.vitest.ts diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 863c4d447..dd04d1915 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -27,6 +27,7 @@ import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js"; import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; import { getConfigDependentToolDefinitions } from "../../tools"; import { encodeMCPToolUri } from "../../tools/callTool"; +import { getMCPToolName } from "../../tools/mcpToolName"; import { getConfigJsonPath, getConfigYamlPath } from "../../util/paths"; import { localPathOrUriToPath } from "../../util/pathToUri"; import { Telemetry } from "../../util/posthog"; @@ -156,7 +157,7 @@ export default async function doLoadConfig(options: { displayTitle: server.name + " " + tool.name, function: { description: tool.description, - name: tool.name, + name: getMCPToolName(server, tool), parameters: tool.inputSchema, }, faviconUrl: server.faviconUrl, @@ -164,6 +165,7 @@ export default async function doLoadConfig(options: { type: "function" as const, uri: encodeMCPToolUri(server.id, tool.name), group: server.name, + originalFunctionName: tool.name, })); newConfig.tools.push(...serverTools); diff --git a/core/index.d.ts b/core/index.d.ts index ad778d3d8..f16713dc5 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -989,6 +989,7 @@ export interface Tool { uri?: string; faviconUrl?: string; group: string; + originalFunctionName?: string; } interface ToolChoice { diff --git a/core/tools/mcpToolName.ts b/core/tools/mcpToolName.ts new file mode 100644 index 000000000..6440ef5e7 --- /dev/null +++ b/core/tools/mcpToolName.ts @@ -0,0 +1,9 @@ +import { MCPServerStatus, MCPTool } from ".."; + +export function getMCPToolName(server: MCPServerStatus, tool: MCPTool) { + const serverPrefix = server.name.split(" ").join("_").toLowerCase(); + if (tool.name.startsWith(serverPrefix)) { + return tool.name; + } + return `${serverPrefix}_${tool.name}`; +} diff --git a/core/tools/mcpToolName.vitest.ts b/core/tools/mcpToolName.vitest.ts new file mode 100644 index 000000000..8c20f630a --- /dev/null +++ b/core/tools/mcpToolName.vitest.ts @@ -0,0 +1,57 @@ +import { expect, test } from "vitest"; +import { MCPServerStatus, MCPTool } from ".."; +import { getMCPToolName } from "./mcpToolName"; + +const createMcpServer = (name: string): MCPServerStatus => ({ + name, + errors: [], + prompts: [], + tools: [], + resources: [], + resourceTemplates: [], + status: "connected", + id: "", + transport: { + type: "sse", + url: "", + }, +}); + +const createMCPTool = (name: string): MCPTool => ({ + name, + inputSchema: { + type: "object", + }, +}); + +test("getMCPToolName - adds server prefix to tool name when not present", () => { + const server = createMcpServer("Github"); + const tool = createMCPTool("create_pull_request"); + + const result = getMCPToolName(server, tool); + expect(result).toBe("github_create_pull_request"); +}); + +test("getMCPToolName - preserves tool name when it already starts with server prefix", () => { + const server = createMcpServer("Github"); + const tool = createMCPTool("github_create_pull_request"); + + const result = getMCPToolName(server, tool); + expect(result).toBe("github_create_pull_request"); +}); + +test("getMCPToolName - handles server names with spaces", () => { + const server = createMcpServer("Azure DevOps"); + const tool = createMCPTool("create_pipeline"); + + const result = getMCPToolName(server, tool); + expect(result).toBe("azure_devops_create_pipeline"); +}); + +test("getMCPToolName - handles mixed case in server names", () => { + const server = createMcpServer("GitLab"); + const tool = createMCPTool("create_merge_request"); + + const result = getMCPToolName(server, tool); + expect(result).toBe("gitlab_create_merge_request"); +}); diff --git a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx index f7b0a97d1..b92816839 100644 --- a/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx +++ b/gui/src/components/mainInput/Lump/sections/tool-policies/ToolPolicyItem.tsx @@ -102,7 +102,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { /> )} - {props.tool.function.name} + {props.tool.originalFunctionName ?? props.tool.function.name}
@@ -124,16 +124,16 @@ function ToolPolicyItem(props: ToolDropdownItemProps) { ) : policy === "allowedWithoutPermission" ? ( <> - Auto - + Auto + Automatic ) : ( // allowedWithPermission <> - Ask - + Ask + Ask First From cd6e2ab23f1445c4da567f13e3ee5f9b45343fd5 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 4 Jun 2025 16:48:27 -0700 Subject: [PATCH 3/5] BROKEN: mcp conversion utils, tool name updates --- core/commands/slash/mcp.ts | 22 +++--- core/config/profile/doLoadConfig.ts | 90 +++++++++------------- core/tools/mcpToolName.vitest.ts | 2 +- core/tools/{mcpToolName.ts => mcpTools.ts} | 6 +- 4 files changed, 51 insertions(+), 69 deletions(-) rename core/tools/{mcpToolName.ts => mcpTools.ts} (51%) diff --git a/core/commands/slash/mcp.ts b/core/commands/slash/mcp.ts index 84df38989..a4dad2802 100644 --- a/core/commands/slash/mcp.ts +++ b/core/commands/slash/mcp.ts @@ -1,28 +1,30 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { PromptMessage } from "@modelcontextprotocol/sdk/types.js"; -import { ChatMessage, SlashCommand } from "../../index.js"; +import { ChatMessage, MCPPrompt, SlashCommand } from "../../index.js"; import { renderChatMessage } from "../../util/messageContent.js"; -export function constructMcpSlashCommand( +export function mcpPromptToSlashCommand( client: Client, - name: string, - description?: string, - args?: string[], + prompt: MCPPrompt, ): SlashCommand { return { - name, - description: description ?? "MCP Prompt", + name: prompt.name, + description: prompt.description ?? "MCP Prompt", params: {}, run: async function* (context) { const argsObject: { [key: string]: string } = {}; const userInput = context.input.split(" ").slice(1).join(" "); - if (args) { - args.forEach((arg, i) => { + if (prompt.arguments) { + const argNames = prompt.arguments.map((a) => a.name); + argNames.forEach((arg, i) => { argsObject[arg] = ""; // userInput }); } - const result = await client.getPrompt({ name, arguments: argsObject }); + const result = await client.getPrompt({ + name: prompt.name, + arguments: argsObject, + }); const mcpMessages: PromptMessage[] = result.messages; const messages: ChatMessage[] = mcpMessages.map((msg) => { if (msg.content.type !== "text") { diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index dd04d1915..ee93210fb 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -17,7 +17,7 @@ import { SerializedContinueConfig, Tool, } from "../../"; -import { constructMcpSlashCommand } from "../../commands/slash/mcp"; +import { mcpPromptToSlashCommand } from "../../commands/slash/mcp"; import { MCPManagerSingleton } from "../../context/mcp/MCPManagerSingleton"; import MCPContextProvider from "../../context/providers/MCPContextProvider"; import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js"; @@ -26,8 +26,7 @@ import { getControlPlaneEnv } from "../../control-plane/env.js"; import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js"; import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; import { getConfigDependentToolDefinitions } from "../../tools"; -import { encodeMCPToolUri } from "../../tools/callTool"; -import { getMCPToolName } from "../../tools/mcpToolName"; +import { mcpToolToTool } from "../../tools/mcpTools"; import { getConfigJsonPath, getConfigYamlPath } from "../../util/paths"; import { localPathOrUriToPath } from "../../util/pathToUri"; import { Telemetry } from "../../util/posthog"; @@ -140,6 +139,13 @@ export default async function doLoadConfig(options: { // Rectify model selections for each role newConfig = rectifySelectedModelsFromGlobalContext(newConfig, profileId); + // Add tools that depend on rules etc. + newConfig.tools.push( + ...getConfigDependentToolDefinitions({ + rules: newConfig.rules, + }), + ); + // Add things from MCP servers const mcpManager = MCPManagerSingleton.getInstance(); const mcpServerStatuses = mcpManager.getStatuses(); @@ -151,31 +157,22 @@ export default async function doLoadConfig(options: { }); newConfig.mcpServerStatuses = serializableStatuses; + // Keep track of tool names to avoid duplicates + const toolNames = new Set(); + + newConfig.tools.forEach((tool) => { + toolNames.add(tool.function.name); + }); + for (const server of mcpServerStatuses) { if (server.status === "connected") { - const serverTools: Tool[] = server.tools.map((tool) => ({ - displayTitle: server.name + " " + tool.name, - function: { - description: tool.description, - name: getMCPToolName(server, tool), - parameters: tool.inputSchema, - }, - faviconUrl: server.faviconUrl, - readonly: false, - type: "function" as const, - uri: encodeMCPToolUri(server.id, tool.name), - group: server.name, - originalFunctionName: tool.name, - })); + const serverTools: Tool[] = server.tools.map((tool) => + mcpToolToTool(server, tool), + ); newConfig.tools.push(...serverTools); const serverSlashCommands = server.prompts.map((prompt) => - constructMcpSlashCommand( - server.client, - prompt.name, - prompt.description, - prompt.arguments?.map((a: any) => a.name), - ), + mcpPromptToSlashCommand(server.client, prompt), ); newConfig.slashCommands.push(...serverSlashCommands); @@ -205,45 +202,28 @@ export default async function doLoadConfig(options: { } } - newConfig.tools.push( - ...getConfigDependentToolDefinitions({ - rules: newConfig.rules, - }), - ); + // Warn user about duplicate tool names + // Could change this behavior in a few ways, e.g. to prepend server name to all tool names from that server if ANY are duplicate + // Object.entries(toolNameCounts).forEach(([toolName, count]) => { + // if (count > 1) { + // errors!.push({ + // fatal: false, + // message: `Duplicate (${count}) tools named "${toolName}" detected. Permissions will conflict and usage may be unpredictable`, + // }); + // } + // }); - // Detect duplicate tool names - const counts: Record = {}; - newConfig.tools.forEach((tool) => { - if (counts[tool.function.name]) { - counts[tool.function.name] = counts[tool.function.name] + 1; - } else { - counts[tool.function.name] = 1; - } - }); - - Object.entries(counts).forEach(([toolName, count]) => { - if (count > 1) { - errors!.push({ - fatal: false, - message: `Duplicate (${count}) tools named "${toolName}" detected. Permissions will conflict and usage may be unpredictable`, - }); - } - }); - - const ruleCounts: Record = {}; + // Warn about duplicate rules + const ruleCounts = new Map(); newConfig.rules.forEach((rule) => { if (rule.name) { - if (ruleCounts[rule.name]) { - ruleCounts[rule.name] = ruleCounts[rule.name] + 1; - } else { - ruleCounts[rule.name] = 1; - } + ruleCounts.set(rule.name, (ruleCounts.get(rule.name) || 0) + 1); } }); - Object.entries(ruleCounts).forEach(([ruleName, count]) => { + ruleCounts.forEach((count, ruleName) => { if (count > 1) { - errors!.push({ + errors.push({ fatal: false, message: `Duplicate (${count}) rules named "${ruleName}" detected. This may cause unexpected behavior`, }); diff --git a/core/tools/mcpToolName.vitest.ts b/core/tools/mcpToolName.vitest.ts index 8c20f630a..7b11b26dd 100644 --- a/core/tools/mcpToolName.vitest.ts +++ b/core/tools/mcpToolName.vitest.ts @@ -1,6 +1,6 @@ import { expect, test } from "vitest"; import { MCPServerStatus, MCPTool } from ".."; -import { getMCPToolName } from "./mcpToolName"; +import { getMCPToolName } from "./mcpTools"; const createMcpServer = (name: string): MCPServerStatus => ({ name, diff --git a/core/tools/mcpToolName.ts b/core/tools/mcpTools.ts similarity index 51% rename from core/tools/mcpToolName.ts rename to core/tools/mcpTools.ts index 6440ef5e7..5e4a3f132 100644 --- a/core/tools/mcpToolName.ts +++ b/core/tools/mcpTools.ts @@ -1,9 +1,9 @@ import { MCPServerStatus, MCPTool } from ".."; export function getMCPToolName(server: MCPServerStatus, tool: MCPTool) { - const serverPrefix = server.name.split(" ").join("_").toLowerCase(); - if (tool.name.startsWith(serverPrefix)) { + const serverSuffix = server.name.split(" ").join("_").toLowerCase(); + if (tool.name.endsWith(serverSuffix)) { return tool.name; } - return `${serverPrefix}_${tool.name}`; + return `${tool.name}_${serverSuffix}`; } From fd21b80f590752a10a52b4ad0dcb9461924db043 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 4 Jun 2025 16:52:14 -0700 Subject: [PATCH 4/5] Revert "BROKEN: mcp conversion utils, tool name updates" This reverts commit cd6e2ab23f1445c4da567f13e3ee5f9b45343fd5. --- core/commands/slash/mcp.ts | 22 +++-- core/config/profile/doLoadConfig.ts | 94 +++++++++++++--------- core/tools/{mcpTools.ts => mcpToolName.ts} | 6 +- core/tools/mcpToolName.vitest.ts | 2 +- 4 files changed, 71 insertions(+), 53 deletions(-) rename core/tools/{mcpTools.ts => mcpToolName.ts} (51%) diff --git a/core/commands/slash/mcp.ts b/core/commands/slash/mcp.ts index a4dad2802..84df38989 100644 --- a/core/commands/slash/mcp.ts +++ b/core/commands/slash/mcp.ts @@ -1,30 +1,28 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { PromptMessage } from "@modelcontextprotocol/sdk/types.js"; -import { ChatMessage, MCPPrompt, SlashCommand } from "../../index.js"; +import { ChatMessage, SlashCommand } from "../../index.js"; import { renderChatMessage } from "../../util/messageContent.js"; -export function mcpPromptToSlashCommand( +export function constructMcpSlashCommand( client: Client, - prompt: MCPPrompt, + name: string, + description?: string, + args?: string[], ): SlashCommand { return { - name: prompt.name, - description: prompt.description ?? "MCP Prompt", + name, + description: description ?? "MCP Prompt", params: {}, run: async function* (context) { const argsObject: { [key: string]: string } = {}; const userInput = context.input.split(" ").slice(1).join(" "); - if (prompt.arguments) { - const argNames = prompt.arguments.map((a) => a.name); - argNames.forEach((arg, i) => { + if (args) { + args.forEach((arg, i) => { argsObject[arg] = ""; // userInput }); } - const result = await client.getPrompt({ - name: prompt.name, - arguments: argsObject, - }); + const result = await client.getPrompt({ name, arguments: argsObject }); const mcpMessages: PromptMessage[] = result.messages; const messages: ChatMessage[] = mcpMessages.map((msg) => { if (msg.content.type !== "text") { diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index ee93210fb..dd04d1915 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -17,7 +17,7 @@ import { SerializedContinueConfig, Tool, } from "../../"; -import { mcpPromptToSlashCommand } from "../../commands/slash/mcp"; +import { constructMcpSlashCommand } from "../../commands/slash/mcp"; import { MCPManagerSingleton } from "../../context/mcp/MCPManagerSingleton"; import MCPContextProvider from "../../context/providers/MCPContextProvider"; import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js"; @@ -26,7 +26,8 @@ import { getControlPlaneEnv } from "../../control-plane/env.js"; import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js"; import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; import { getConfigDependentToolDefinitions } from "../../tools"; -import { mcpToolToTool } from "../../tools/mcpTools"; +import { encodeMCPToolUri } from "../../tools/callTool"; +import { getMCPToolName } from "../../tools/mcpToolName"; import { getConfigJsonPath, getConfigYamlPath } from "../../util/paths"; import { localPathOrUriToPath } from "../../util/pathToUri"; import { Telemetry } from "../../util/posthog"; @@ -139,13 +140,6 @@ export default async function doLoadConfig(options: { // Rectify model selections for each role newConfig = rectifySelectedModelsFromGlobalContext(newConfig, profileId); - // Add tools that depend on rules etc. - newConfig.tools.push( - ...getConfigDependentToolDefinitions({ - rules: newConfig.rules, - }), - ); - // Add things from MCP servers const mcpManager = MCPManagerSingleton.getInstance(); const mcpServerStatuses = mcpManager.getStatuses(); @@ -157,22 +151,31 @@ export default async function doLoadConfig(options: { }); newConfig.mcpServerStatuses = serializableStatuses; - // Keep track of tool names to avoid duplicates - const toolNames = new Set(); - - newConfig.tools.forEach((tool) => { - toolNames.add(tool.function.name); - }); - for (const server of mcpServerStatuses) { if (server.status === "connected") { - const serverTools: Tool[] = server.tools.map((tool) => - mcpToolToTool(server, tool), - ); + const serverTools: Tool[] = server.tools.map((tool) => ({ + displayTitle: server.name + " " + tool.name, + function: { + description: tool.description, + name: getMCPToolName(server, tool), + parameters: tool.inputSchema, + }, + faviconUrl: server.faviconUrl, + readonly: false, + type: "function" as const, + uri: encodeMCPToolUri(server.id, tool.name), + group: server.name, + originalFunctionName: tool.name, + })); newConfig.tools.push(...serverTools); const serverSlashCommands = server.prompts.map((prompt) => - mcpPromptToSlashCommand(server.client, prompt), + constructMcpSlashCommand( + server.client, + prompt.name, + prompt.description, + prompt.arguments?.map((a: any) => a.name), + ), ); newConfig.slashCommands.push(...serverSlashCommands); @@ -202,28 +205,45 @@ export default async function doLoadConfig(options: { } } - // Warn user about duplicate tool names - // Could change this behavior in a few ways, e.g. to prepend server name to all tool names from that server if ANY are duplicate - // Object.entries(toolNameCounts).forEach(([toolName, count]) => { - // if (count > 1) { - // errors!.push({ - // fatal: false, - // message: `Duplicate (${count}) tools named "${toolName}" detected. Permissions will conflict and usage may be unpredictable`, - // }); - // } - // }); + newConfig.tools.push( + ...getConfigDependentToolDefinitions({ + rules: newConfig.rules, + }), + ); - // Warn about duplicate rules - const ruleCounts = new Map(); - newConfig.rules.forEach((rule) => { - if (rule.name) { - ruleCounts.set(rule.name, (ruleCounts.get(rule.name) || 0) + 1); + // Detect duplicate tool names + const counts: Record = {}; + newConfig.tools.forEach((tool) => { + if (counts[tool.function.name]) { + counts[tool.function.name] = counts[tool.function.name] + 1; + } else { + counts[tool.function.name] = 1; } }); - ruleCounts.forEach((count, ruleName) => { + Object.entries(counts).forEach(([toolName, count]) => { if (count > 1) { - errors.push({ + errors!.push({ + fatal: false, + message: `Duplicate (${count}) tools named "${toolName}" detected. Permissions will conflict and usage may be unpredictable`, + }); + } + }); + + const ruleCounts: Record = {}; + newConfig.rules.forEach((rule) => { + if (rule.name) { + if (ruleCounts[rule.name]) { + ruleCounts[rule.name] = ruleCounts[rule.name] + 1; + } else { + ruleCounts[rule.name] = 1; + } + } + }); + + Object.entries(ruleCounts).forEach(([ruleName, count]) => { + if (count > 1) { + errors!.push({ fatal: false, message: `Duplicate (${count}) rules named "${ruleName}" detected. This may cause unexpected behavior`, }); diff --git a/core/tools/mcpTools.ts b/core/tools/mcpToolName.ts similarity index 51% rename from core/tools/mcpTools.ts rename to core/tools/mcpToolName.ts index 5e4a3f132..6440ef5e7 100644 --- a/core/tools/mcpTools.ts +++ b/core/tools/mcpToolName.ts @@ -1,9 +1,9 @@ import { MCPServerStatus, MCPTool } from ".."; export function getMCPToolName(server: MCPServerStatus, tool: MCPTool) { - const serverSuffix = server.name.split(" ").join("_").toLowerCase(); - if (tool.name.endsWith(serverSuffix)) { + const serverPrefix = server.name.split(" ").join("_").toLowerCase(); + if (tool.name.startsWith(serverPrefix)) { return tool.name; } - return `${tool.name}_${serverSuffix}`; + return `${serverPrefix}_${tool.name}`; } diff --git a/core/tools/mcpToolName.vitest.ts b/core/tools/mcpToolName.vitest.ts index 7b11b26dd..8c20f630a 100644 --- a/core/tools/mcpToolName.vitest.ts +++ b/core/tools/mcpToolName.vitest.ts @@ -1,6 +1,6 @@ import { expect, test } from "vitest"; import { MCPServerStatus, MCPTool } from ".."; -import { getMCPToolName } from "./mcpTools"; +import { getMCPToolName } from "./mcpToolName"; const createMcpServer = (name: string): MCPServerStatus => ({ name, From 156248133f34f857f2b380d3f5ac21f4269d84b1 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 4 Jun 2025 16:52:47 -0700 Subject: [PATCH 5/5] run terminal command formatting --- core/tools/implementations/runTerminalCommand.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/tools/implementations/runTerminalCommand.ts b/core/tools/implementations/runTerminalCommand.ts index b83adc479..785f4ee30 100644 --- a/core/tools/implementations/runTerminalCommand.ts +++ b/core/tools/implementations/runTerminalCommand.ts @@ -10,7 +10,17 @@ import { const asyncExec = util.promisify(childProcess.exec); -const ENABLED_FOR_REMOTES = ["","local","wsl","dev-container","devcontainer","ssh-remote","attached-container","codespaces","tunnel"]; +const ENABLED_FOR_REMOTES = [ + "", + "local", + "wsl", + "dev-container", + "devcontainer", + "ssh-remote", + "attached-container", + "codespaces", + "tunnel", +]; export const runTerminalCommandImpl: ToolImpl = async (args, extras) => { // Default to waiting for completion if not specified