mirror of
https://github.com/PerpetualSoftware/pad.git
synced 2026-09-25 11:52:08 +00:00
eb896e4469
Adds a top-level `instructions` string to the MCP initialize response so agents know WHEN to reach for pad without having to guess from tool descriptions alone. The Svelte MCP server in the dogfooding session that triggered PLAN-969 does this; pad now does too. Implementation: - internal/mcp/instructions.md (new) — embedded source content. MCP-aware adaptation of skills/pad/SKILL.md's opener: what pad is, when to reach for it, the v0.2 tool catalog summary, resource cheatsheet, workspace resolution order, ref convention, update flow, conventions hint, and the four prompts. - internal/mcp/instructions.go (new) — //go:embed wrapper exposing the content as the Instructions package var. - internal/mcp/server.go — pass server.WithInstructions(Instructions) into NewMCPServer. Single source of truth: the same string ships in both the local stdio handshake AND PLAN-943's HTTPHandlerDispatcher (when remote /mcp mounts in TASK-950 it will reuse the same constant — no docs drift between local and remote surfaces). Test: TestServer_InitializeAdvertisesInstructions drives a real initialize round-trip and asserts the response's Instructions field equals the embedded source. Sanity-checks the embed didn't truncate. Parent: TASK-971 → PLAN-969.
25 lines
993 B
Go
25 lines
993 B
Go
package mcp
|
|
|
|
import _ "embed"
|
|
|
|
// Instructions is the server-level instructions string advertised to
|
|
// MCP clients in the initialize response. Tells agents WHEN to reach
|
|
// for pad and gives a quick orientation to the tool surface and
|
|
// resources — same role the description text plays in tools/list,
|
|
// but at the server level so a host can show it before the first
|
|
// tool call.
|
|
//
|
|
// The Svelte MCP server in the dogfooding session that triggered
|
|
// PLAN-969 explicitly told the model "use this whenever Svelte
|
|
// development is involved." Pad does the same: a short, MCP-aware
|
|
// adaptation of skills/pad/SKILL.md's opener, embedded at build
|
|
// time so there's a single source of truth.
|
|
//
|
|
// Both ExecDispatcher (stdio) and HTTPHandlerDispatcher (HTTP) read
|
|
// this same string — the local handshake passes it via
|
|
// server.WithInstructions in NewServer (server.go); the future
|
|
// remote handshake in PLAN-943 will do the same.
|
|
//
|
|
//go:embed instructions.md
|
|
var Instructions string
|