buildSessionWorkspaceHint returns a compact prompt block that teaches the buildMCPToolsSection renders the system-prompt block listing MCP tools available this turn, plus the routing hint that biases the model toward `mcp_*` when an MCP server covers the requested op. Pure function so the rendering
(tools []models.ToolDefinition, isCoderMode bool)
| 3174 | // Pure function so the rendering can be tested without spinning up an |
| 3175 | // AgentMode instance and a live LLM client. |
| 3176 | func buildMCPToolsSection(tools []models.ToolDefinition, isCoderMode bool) string { |
| 3177 | var b strings.Builder |
| 3178 | b.WriteString("MCP Tools (external):\n") |
| 3179 | b.WriteString(" Para invocar: <tool_call name=\"mcp_<tool>\" args='{\"param\":\"value\"}' />\n") |
| 3180 | b.WriteString(" Antes do primeiro uso de uma tool MCP, obtenha o schema completo de parâmetros com " + |
| 3181 | "<tool_call name=\"@tools\" args='{\"cmd\":\"describe\",\"args\":{\"name\":\"mcp_<tool>\"}}' /> — não adivinhe argumentos.\n") |
| 3182 | b.WriteString(" Se invocar sem os parâmetros obrigatórios, o sistema retornará o schema para você corrigir.\n") |
| 3183 | if isCoderMode { |
| 3184 | b.WriteString("\n " + i18n.T("agent.mcp.routing_hint_coder") + "\n") |
| 3185 | } else { |
| 3186 | b.WriteString("\n " + i18n.T("agent.mcp.routing_hint_agent") + "\n") |
| 3187 | } |
| 3188 | b.WriteString("\n") |
| 3189 | for _, t := range tools { |
| 3190 | b.WriteString(fmt.Sprintf(" - %s: %s\n", t.Function.Name, t.Function.Description)) |
| 3191 | } |
| 3192 | return b.String() |
| 3193 | } |
| 3194 | |
| 3195 | // buildMCPEmptyNote returns the system-prompt note shown to the model |
| 3196 | // when MCP is configured but no tool is usable yet — either still |