core: Slack MCP catalog budget hides tools with long descriptions

Ouverte Adaptée aux débutants
#65,997 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
72/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
typescript
Domaine
ai-infra-agents

Piste de recherche

Commence à INLINE_BUDGET dans packages/core/src/codemode/catalog.ts vers la ligne 52 et lis comment chaque signature d’outil est ajoutée jusqu’à épuisement du budget. Trouve ensuite où le flag codemode par serveur est parsé depuis opencode.json pour voir où un budget configurable serait transmis. L’état terminé ressemble au catalogue listant tous les ~30 outils Slack (ou à un budget configurable par l’utilisateur avec une valeur par défaut plus élevée), les tests existants du catalogue continuant de passer.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

area/mcp platform/windows type/feature version/v2

Summary

The Code Mode tool catalog uses a hardcoded 2000-character inline budget (INLINE_BUDGET) for rendering tool signatures. When an MCP server provides tools with long descriptions (typical of Slack MCP's 30 tools at ~1400 chars avg), the budget exhausts after 2-5 tools. The model sees only those few tools and cannot call the remaining 28+, effectively hiding the majority of an MCP server's tools.

Environment

  • opencode version: 2.3.0
  • OS: Windows_NT 10.0.26300 (win32 x64)
  • Terminal: xterm-256color
  • Shell: C:\WINDOWS\system32\cmd.exe
  • Install/channel: latest (npm global)
  • Active plugins: None found in config

Reproduction

  1. Configure Slack MCP server in opencode.json:
    {
      "mcp": {
        "servers": {
          "slack": {
            "type": "remote",
            "url": "https://mcp.slack.com/mcp",
            "oauth": false,
            "headers": { "Authorization": "Bearer {env:SLACK_MCP_TOKEN}" }
          }
        }
      }
    }
    
  2. Open a session that connects the Slack MCP server. Logs confirm: mcp connected, server=slack, tools=30.
  3. Observe the model can call at most 2 Slack tools (slack_add_list_record, slack_add_reaction) through Code Mode. The other 28 tools are not visible in the Code Mode catalog.
  4. All 30 tools have valid JSON schemas (inputSchema.type = "object") and pass validation — the issue is the inline budget, not schema filtering.

Expected Behavior

The Code Mode catalog should display all or most tools from each connected MCP server, allowing the model to call any of them.

Actual Behavior

Only 2 of 30 Slack MCP tools appear in the Code Mode catalog. Slack tools have very long descriptions (e.g., slack_read_list = 3646 chars, slack_create_list = 2470 chars). The hardcoded 2000-char budget exhausts after ~2 tools:

// packages/core/src/codemode/catalog.ts line 52
const INLINE_BUDGET = 2_000

// Each Slack tool listing costs ~1500-450 chars:
//   "  - slack_send_message // Sends a message to a Slack channel..." (~250 chars)
//   "  - slack_create_list // Creates a new Slack List with..." (~390 chars)
// Budget exhausts after 2-5 tools depending on description length.

Additional Context

Root cause: INLINE_BUDGET = 2_000 is hardcoded with no config override. Each tool listing costs approximately line.length / 4 characters (1 char ≈ 0.25 tokens). Slack MCP tools have descriptions ranging from 236 to 3646 chars, producing inline entries of ~150-470 chars each. The budget exhausts after 2-5 tools.

Affected MCP servers: This affects any MCP server whose tools have descriptions > ~400 chars (budget / 5 tools). Slack MCP is the primary example; many other MCP servers could be impacted.

Workarounds tried:

  • Verified all 30 Slack tools have valid schemas — schema filtering is NOT the issue.
  • Slack REST API works directly (auth.test, conversations.list, chat.postMessage), confirming the Slack token is valid and the workspace is accessible.
  • Setting "codemode": false on the Slack MCP config moves tools to direct tool calls (full exposure), but that's a workaround, not a fix.

Suggested fix: Make INLINE_BUDGET configurable via either:

  1. A top-level config option (e.g., codemode.catalog_budget), or
  2. A flag (e.g., codemode_catalog_budget), defaulting to a higher value (e.g., 8000-16000) in all builds.
Langage dominant
TypeScript
Étoiles
228k
Forks
31k
Merge moyen
3 h 22 min
PR mergées (30 j)
476

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de anomalyco/opencode

Toutes les issues de anomalyco/opencode

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.