Skip to content

Commit 825a492

Browse files
committed
feat(mcp): add server instructions to guide efficient prompt delegation
Leverage MCP WithInstructions to tell Claude Chat to send concise functional prompts instead of writing code or documentation that Claude Code will rewrite anyway. Reduces token waste significantly.
1 parent cfb5a4f commit 825a492

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

internal/mcp/server.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,26 @@ type Deps struct {
2020
Version string
2121
}
2222

23+
// serverInstructions are returned to the client during MCP initialize.
24+
// They guide Claude Chat to delegate coding to Claude Code efficiently.
25+
const serverInstructions = `Herald bridges you (Claude Chat) to Claude Code running on the user's machine.
26+
27+
IMPORTANT — prompt efficiency:
28+
- Claude Code has FULL access to the codebase, files, and git history. You do NOT need to write code, file contents, or documentation in your prompts.
29+
- Send concise, functional prompts that describe WHAT to do, not HOW. Claude Code will figure out the implementation.
30+
- BAD: pasting a full file with modifications, writing code blocks for Claude Code to apply, or drafting documentation to be written.
31+
- GOOD: "Add rate limiting middleware to the API routes (200 req/min per token)" or "Fix the null pointer in task.go when priority is empty".
32+
- Think of yourself as a product manager giving clear requirements, not a developer writing code.
33+
- If the user provides code or file content, summarize the intent instead of forwarding it verbatim.`
34+
2335
// NewServer creates and configures the MCP server with all tools registered.
2436
func NewServer(deps *Deps) *server.MCPServer {
2537
s := server.NewMCPServer(
2638
"Herald",
2739
deps.Version,
2840
server.WithToolCapabilities(true),
2941
server.WithLogging(),
42+
server.WithInstructions(serverInstructions),
3043
)
3144

3245
registerTools(s, deps)

internal/mcp/tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func registerTools(s *server.MCPServer, deps *Deps) {
2222
mcp.WithDescription("Start a Claude Code task on a project. Returns immediately with a task ID. The task runs asynchronously — use check_task to monitor progress. Tasks typically take 1-10 minutes. Use check_task with wait_seconds=30 to long-poll efficiently instead of polling rapidly."),
2323
mcp.WithString("prompt",
2424
mcp.Required(),
25-
mcp.Description("The task instructions for Claude Code"),
25+
mcp.Description("The task instructions for Claude Code. Send concise, functional requirements — describe WHAT to do, not HOW. Do NOT write code, file contents, or documentation here: Claude Code has the full codebase and will implement it. Think clear requirements, not code."),
2626
),
2727
mcp.WithString("context",
2828
mcp.Description("Human-readable context explaining why this task was launched, for tracking across chat sessions"),

0 commit comments

Comments
 (0)