Merge branch 'main' of github.com:continuedev/continue into jacob/enhancement/bubble-up-config-errors

This commit is contained in:
Jacob Kim 2025-06-06 14:05:29 -07:00
commit 20b01d9600
6 changed files with 78 additions and 16 deletions

View file

@ -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);

1
core/index.d.ts vendored
View file

@ -992,6 +992,7 @@ export interface Tool {
uri?: string;
faviconUrl?: string;
group: string;
originalFunctionName?: string;
}
interface ToolChoice {

View file

@ -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}`;
}

View file

@ -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");
});

View file

@ -6,13 +6,12 @@ import {
} from "@heroicons/react/24/outline";
import { RuleWithSource } from "core";
import {
DEFAULT_CHAT_SYSTEM_MESSAGE,
DEFAULT_CHAT_SYSTEM_MESSAGE_URL,
DEFAULT_AGENT_SYSTEM_MESSAGE,
DEFAULT_AGENT_SYSTEM_MESSAGE_URL,
DEFAULT_CHAT_SYSTEM_MESSAGE,
DEFAULT_CHAT_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<RuleCardProps> = ({ rule }) => {
const smallFont = useFontSize(-2);
const tinyFont = useFontSize(-3);
return (
<div
style={{
borderRadius: defaultBorderRadius,
border: `1px solid ${vscCommandCenterActiveBorder}`,
}}
className="flex flex-col px-2 py-1.5 transition-colors"
>
<div className="border-border flex flex-col rounded-sm px-2 py-1.5 transition-colors">
<div className="flex flex-col">
<div className="flex flex-row justify-between gap-1">
<span

View file

@ -102,7 +102,7 @@ function ToolPolicyItem(props: ToolDropdownItemProps) {
/>
)}
<span className="line-clamp-1 break-all">
{props.tool.function.name}
{props.tool.originalFunctionName ?? props.tool.function.name}
</span>
</div>
</div>
@ -124,16 +124,16 @@ function ToolPolicyItem(props: ToolDropdownItemProps) {
</>
) : policy === "allowedWithoutPermission" ? (
<>
<span className="text-green-500 sm:hidden">Auto</span>
<span className="hidden text-green-500 sm:inline-block">
<span className="text-success sm:hidden">Auto</span>
<span className="text-success hidden sm:inline-block">
Automatic
</span>
</>
) : (
// allowedWithPermission
<>
<span className="text-yellow-500 sm:hidden">Ask</span>
<span className="hidden text-yellow-500 sm:inline-block">
<span className="text-warning sm:hidden">Ask</span>
<span className="text-warning hidden sm:inline-block">
Ask First
</span>
</>