MCP ask_codebase rejects explicit languageModel: getLanguageModelKey includes displayName which the MCP schema doesn't expose
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- api
Research direction
Start in packages/web/src/features/mcp/askCodebase.ts and inspect how the requested languageModel is matched against configured models; compare that path with getLanguageModelKey in packages/web/src/features/chat/utils.ts. Done means ask_codebase accepts the schema's {provider, model} shape for configured models while preserving the existing default behavior and any other uses of getLanguageModelKey.
Written by the indexing model from the issue text.
Description
Summary
When calling the MCP tool ask_codebase with an explicit languageModel parameter, the request is rejected with 400 Language model '<provider>/<model>' is not configured. — even when list_language_models clearly shows that exact model configured.
Version
- Sourcebot
v4.16.11(Helm chart0.1.76) - MCP client
@sourcebot/mcp@1.0.18(vianpx -y @sourcebot/mcp@latest)
Reproduction
Config in sourcebot.json / helm values sourcebot.config:
models:
- provider: anthropic
model: claude-sonnet-4-6
displayName: Claude Sonnet 4.6
token:
env: ANTHROPIC_API_KEY
- provider: anthropic
model: claude-opus-4-7
displayName: Claude Opus 4.7 (slow, highest quality)
token:
env: ANTHROPIC_API_KEY
- Call
list_language_modelsvia MCP — returns both models as expected:
[
{"provider":"anthropic","model":"claude-sonnet-4-6","displayName":"Claude Sonnet 4.6"},
{"provider":"anthropic","model":"claude-opus-4-7","displayName":"Claude Opus 4.7 (slow, highest quality)"}
]
- Call
ask_codebasewith an explicit language model of the exact shape the tool's JSON schema requires ({provider, model}):
{
"query": "...",
"languageModel": {"provider": "anthropic", "model": "claude-opus-4-7"}
}
Result:
{"statusCode":400,"errorCode":"INVALID_REQUEST_BODY","message":"Language model 'anthropic/claude-opus-4-7' is not configured."}
Same happens for claude-sonnet-4-6 — every explicit model is rejected, regardless of which one.
ask_codebase without languageModel works fine — the implicit default (first model in config) is used correctly. So the failure is specifically in the explicit-selection path.
Root cause
getLanguageModelKey in packages/web/src/features/chat/utils.ts builds the match key from provider + model + displayName:
export const getLanguageModelKey = (model: LanguageModelInfo) => {
return `${model.provider}-${model.model}-${model.displayName}`;
}
askCodebase uses this function to match the requested model against configured models in packages/web/src/features/mcp/askCodebase.ts:
const matchingModel = configuredModels.find(
(m) => getLanguageModelKey(m) === getLanguageModelKey(requestedLanguageModel)
);
The MCP JSON schema for ask_codebase.languageModel only requires {provider, model} — displayName is not part of the schema and clients cannot provide it:
languageModel: {
provider: (required),
model: (required)
}
So at match time:
- Configured entry key:
anthropic-claude-opus-4-7-Claude Opus 4.7 (slow, highest quality) - Requested entry key:
anthropic-claude-opus-4-7-undefined
Keys never match → 400 for any explicit selection.
Suggested fix
Either:
- Match on provider+model only in
askCodebase.ts(simplest —displayNameis a cosmetic label, not an identity key):const matchingModel = configuredModels.find( (m) => m.provider === requestedLanguageModel.provider && m.model === requestedLanguageModel.model ); - Or drop
displayNamefromgetLanguageModelKeyso the match is consistent with the externally-visible identity.
Option 1 is the minimal change that keeps getLanguageModelKey untouched if it is used elsewhere where displayName matters.
Impact
- MCP clients cannot route a specific question to a non-default model — the dropdown selection in the Web UI works because the UI presumably submits the full
LanguageModelInfo(includingdisplayName), but the MCP tool schema intentionally does not exposedisplayName, so there is no workaround. - Defaulting to the first model in config still works, so this is not a total outage, but it removes a documented MCP capability.
Happy to open a PR if helpful.
- Dominant language
- TypeScript
- Stars
- 3.9k
- Forks
- 374
- Avg merge
- 21h 18m
- Merged PRs (30d)
- 39
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sourcebot-dev/sourcebot
-
bug triage needed
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
sourcebot-dev/sourcebot#1681 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
sourcebot-dev/sourcebot#1633 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sourcebot-dev/sourcebot#1384 · 4 comments ·
-
bug triage needed
Difficulty 3/5 1-2 days Newbie friendliness 48/100
sourcebot-dev/sourcebot#1661 · 1 comment ·
-
Feature
Difficulty 4/5 3-5 days Newbie friendliness 50/100
sourcebot-dev/sourcebot#1659 · 1 comment ·
All issues in sourcebot-dev/sourcebot
Similar issues
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
supermomonga/zcode-acp#24 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100