Add prompts primitive (prompts/list, prompts/get) #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add the Prompts primitive — server exposes reusable parameterised prompt templates the client surfaces as a menu (slash-commands, snippets, "insert template").
Goal
A small server can ship a library of canned prompts ("explain this diff", "draft a release note for version X") without baking them into each client. The MCP spec defines this surface; lmcp currently has none of it.
Methods to add
prompts/list{ prompts: [{ name, description?, arguments?: [{ name, description?, required? }] }], nextCursor? }prompts/get{ name, arguments?: { … } }→{ description?, messages: [{ role, content: { type, text } }] }notifications/prompts/list_changedAPI for lmcp
Capabilities
Scope (v1)
prompts/list,prompts/get.notifications/prompts/list_changedif a prompt is registered post-init.textcontent blocks in v1. Image/audio/resource-link content can come later if needed.Out of scope
Priority
Medium. Smaller surface than Resources, but mechanical to implement (mirrors the existing tool-registration machinery). Half a day.
Implemented. Added in lmcp.lua:
self.promptsstorage +opts.promptsopt-in flag mirroring resources disciplineserver:prompt(name, opts, handler)registration. handler returns string (single user text message) or{ description?, messages = {...} }for full controlprompts/list+prompts/getdispatch branchesnotify_prompts_changed()+notifications/prompts/list_changedqueue path (delivery NYI per #16)_enqueue_list_changed(self, method)helper used by both resources and promptsprompts/listuses the same paginate helper from #12Added one sample prompt (
release_note) to example_server.lua + the LMCP_TRANSPORT=stdio switch.Verified live over stdio: capabilities include prompts, list returns one entry with arguments schema, get returns spec-shaped messages, missing-name → -32602, unknown name → -32002 (MCP-conventional "not found").