Skip to content

Commit 24bca98

Browse files
authored
fix(code): remove mcp tools from haiku (primary sessions) (#1474)
## Problem - posthog mcp is >200k tokens - haiku doesn't support tool search - all 200k+ tokens are inlined into the haiku initial prompt - ...so haiku sessions do not work at all right now <!-- Who is this for and what problem does it solve? --> <!-- Closes #ISSUE_ID --> ## Changes does not inject mcp definitiions into new sessions with haiku <!-- What did you change and why? --> <!-- If there are frontend changes, include screenshots. --> ## How did you test this? manually <!-- Describe what you tested -- manual steps, automated tests, or both. --> <!-- If you're an agent, only list tests you actually ran. -->
1 parent e7f293b commit 24bca98

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/agent/src/adapters/claude/claude-agent.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ import {
6767
getEffortOptions,
6868
resolveModelPreference,
6969
supports1MContext,
70+
supportsMcpInjection,
7071
toSdkModelId,
7172
} from "./session/models";
7273
import {
@@ -797,7 +798,11 @@ export class ClaudeAcpAgent extends BaseAcpAgent {
797798
const settingsManager = new SettingsManager(cwd);
798799
await settingsManager.initialize();
799800

800-
const mcpServers = parseMcpServers(params);
801+
const earlyModelId =
802+
settingsManager.getSettings().model || meta?.model || "";
803+
const mcpServers = supportsMcpInjection(earlyModelId)
804+
? parseMcpServers(params)
805+
: {};
801806
const systemPrompt = buildSystemPrompt(meta?.systemPrompt);
802807

803808
this.logger.info(isResume ? "Resuming session" : "Creating new session", {

packages/agent/src/adapters/claude/session/models.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ export function supportsMaxEffort(modelId: string): boolean {
3737
return MODELS_WITH_MAX_EFFORT.has(modelId);
3838
}
3939

40+
const MODELS_TO_EXCLUDE_MCP_TOOLS = new Set(["claude-haiku-4-5"]);
41+
42+
export function supportsMcpInjection(modelId: string): boolean {
43+
return !MODELS_TO_EXCLUDE_MCP_TOOLS.has(modelId);
44+
}
45+
4046
interface EffortOption {
4147
value: string;
4248
name: string;

0 commit comments

Comments
 (0)