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 ba3712d05..d3487fe30 100644
--- a/core/index.d.ts
+++ b/core/index.d.ts
@@ -992,6 +992,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
>