fix: draft_post prompt is offered only to grants that may write

The prompt directs journal_create_post, so it carries pact.MCPPrompt.Writes
and pier hides it from read-only grants.
This commit is contained in:
Jakub Zych
2026-10-23 17:03:35 +02:00
parent a9a9b8098d
commit b1299021cd
2 changed files with 4 additions and 1 deletions

View File

@@ -188,7 +188,7 @@ With the framework's MCP endpoint mounted (`summer.yaml` `build.tags: [summercms
| `journal_update_post` | `PUT /_journal/api/v1/posts/{id}` | `id` and any of the create fields; only the fields sent change |
| `journal_delete_post` | `DELETE /_journal/api/v1/posts/{id}` | `id` (destructive) |
The prompt `journal_draft_post` (arguments `topic`, required, and `tone`) asks the agent to draft a post, reuse existing categories and tags and save it with `journal_create_post` as a draft. A grant without the `write` scope lists only the read tools. Publishing still needs `golem15.journal.access_publish` and editing another author's post `golem15.journal.access_other_posts`; the route answers its usual error body, which the agent receives as the tool error. The media and featured-image uploads (multipart) are not tools.
The prompt `journal_draft_post` (arguments `topic`, required, and `tone`) asks the agent to draft a post, reuse existing categories and tags and save it with `journal_create_post` as a draft; it is marked `Writes`, so it is offered only to grants that may write. A grant without the `write` scope lists only the read tools and no prompt. Publishing still needs `golem15.journal.access_publish` and editing another author's post `golem15.journal.access_other_posts`; the route answers its usual error body, which the agent receives as the tool error. The media and featured-image uploads (multipart) are not tools.
### Blog Editor

3
mcp.go
View File

@@ -157,6 +157,9 @@ func (p *Plugin) MCP() pact.MCP {
Description: "Drafts a Journal post on a topic and saves it as a draft.",
Guard: mcpGuard,
Permissions: []string{mcpAccessPosts},
// It directs journal_create_post, so a read-only grant does
// not see it.
Writes: true,
Arguments: []pact.MCPPromptArgument{
{Name: "topic", Description: "what the post is about", Required: true},
{Name: "tone", Description: "the tone of voice, for example friendly or formal"},