Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

MCP ask_codebase rejects explicit languageModel: getLanguageModelKey includes displayName which the MCP schema doesn't expose

オープン 初心者向け
#1,137 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
typescript
領域
api

調査の方向性

packages/web/src/features/mcp/askCodebase.ts から始め、要求された languageModel が設定済みモデルとどのように照合されているかを確認します。その処理を packages/web/src/features/chat/utils.ts の getLanguageModelKey と比較します。完了条件は、ask_codebase が設定済みモデルに対してスキーマの {provider, model} 形式を受け入れ、既存のデフォルト動作と getLanguageModelKey のその他の用途を維持することです。

索引モデルが issue の本文から書いたものです。

説明

ask_sb bug

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 chart 0.1.76)
  • MCP client @sourcebot/mcp@1.0.18 (via npx -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
  1. Call list_language_models via 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)"}
]
  1. Call ask_codebase with 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:

  1. Match on provider+model only in askCodebase.ts (simplest — displayName is a cosmetic label, not an identity key):
    const matchingModel = configuredModels.find(
        (m) => m.provider === requestedLanguageModel.provider &&
               m.model    === requestedLanguageModel.model
    );
    
  2. Or drop displayName from getLanguageModelKey so 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 (including displayName), but the MCP tool schema intentionally does not expose displayName, 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.

主要言語
TypeScript
スター
3.9k
フォーク
374
平均マージ
21時間 18分
マージ済み PR(30日)
39

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sourcebot-dev/sourcebot のほかの issue

sourcebot-dev/sourcebot の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。