@@ -0,0 +1,41 @@
+package agent
+
+import (
+ "context"
+ "testing"
+
+ "github.com/charmbracelet/crush/internal/config"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+)
+
+func TestCoderPromptDockerMCPBias(t *testing.T) {
+ t.Run("includes Docker MCP bias when enabled", func(t *testing.T) {
+ cfg, err := config.Init(t.TempDir(), "", false)
+ require.NoError(t, err)
+ if cfg.MCP == nil {
+ cfg.MCP = map[string]config.MCPConfig{}
+ }
+ cfg.MCP[config.DockerMCPName] = config.MCPConfig{Type: config.MCPStdio, Command: "docker"}
+
+ prompt, err := coderPrompt()
+ require.NoError(t, err)
+
+ systemPrompt, err := prompt.Build(context.Background(), "", "", *cfg)
+ require.NoError(t, err)
+ assert.Contains(t, systemPrompt, "you must attempt Docker MCP discovery first")
+ })
+
+ t.Run("does not include Docker MCP bias when disabled", func(t *testing.T) {
+ cfg, err := config.Init(t.TempDir(), "", false)
+ require.NoError(t, err)
+ delete(cfg.MCP, config.DockerMCPName)
+
+ prompt, err := coderPrompt()
+ require.NoError(t, err)
+
+ systemPrompt, err := prompt.Build(context.Background(), "", "", *cfg)
+ require.NoError(t, err)
+ assert.NotContains(t, systemPrompt, "you must attempt Docker MCP discovery first")
+ })
+}
@@ -296,6 +296,9 @@ After significant changes:
- Summarize tool output for user (they don't see it)
- Never use `curl` through the bash tool it is not allowed use the fetch tool instead.
- Only use the tools you know exist.
+{{- $docker := index .Config.MCP "docker" -}}{{if and (ne $docker.Command "") (not $docker.Disabled)}}
+- For tasks involving databases, cloud infrastructure, Kubernetes, browsers, APIs, or containers, you must attempt Docker MCP discovery first (`mcp_docker_mcp-find`) and load a relevant MCP (`mcp_docker_mcp-add`) before proceeding with non-MCP tools.
+{{end}}
<bash_commands>
**CRITICAL**: The `description` parameter is REQUIRED for all bash tool calls. Always provide it.