fix(pact): add MCPPrompt.Writes so a write-directing prompt sits under the read/write ceiling
- pact.MCPPrompt.Writes (additive; the zero value keeps today's listing) - pier's allowsPrompt hides a prompt declared with Writes from an identity without write, as it hides a tool that is not read-only (C-IN-01 framework part, P-28)
This commit is contained in:
@@ -151,7 +151,7 @@ func (p *Plugin) Schedule() []pact.ScheduledCommand {
|
||||
| `pact.HasMCP` | Implemented by a plugin that declares MCP tools and prompts for the framework's MCP endpoint. |
|
||||
| `pact.MCP` | The declaration: `Tools` and `Prompts` (resources are a later field of the same struct). |
|
||||
| `pact.MCPTool` | One tool bound to one of the plugin's own token-guarded routes by `Method` and `Path`: unprefixed `Name`, static `Title` and `Description`, the `Guard` it runs as, the `Input` struct (zero value; `path`, `query`, `json` and `jsonschema` tags map and describe the arguments), an optional `Output` struct, extra `Permissions` for the listing and the `ReadOnly`, `Destructive`, `Idempotent` and `OpenWorld` overrides of the annotations derived from the method (nil means derived). |
|
||||
| `pact.MCPPrompt` | One prompt template: name, title, description, guard, permissions, `Arguments` (`pact.MCPPromptArgument`) and the `Render` func returning `pact.MCPPromptMessage` values (`Role` user or assistant, `Text`). |
|
||||
| `pact.MCPPrompt` | One prompt template: name, title, description, guard, permissions, `Arguments` (`pact.MCPPromptArgument`), the `Render` func returning `pact.MCPPromptMessage` values (`Role` user or assistant, `Text`) and `Writes`, set when the prompt directs tools that are not read-only so it is listed only for an identity that may write (zero value: offered to read-only grants too). |
|
||||
| `pact.MCPGuard` | A guard provider the owner of a route guard publishes: its name, whether a middleware list is token-guarded by it, the scopes and permissions a middleware list requires (`pact.MCPRequirements`), whether a subject may call a tool, and the pre-resolved principal for one in-process call (`pact.MCPDispatch`). |
|
||||
| `pact.MCPGuards` | The registry of guard providers published on the application; `pact.NewMCPGuards` creates it, `Register` refuses an empty or duplicate name with a `pact:` error naming the guard, `Lookup` finds one and `Names` lists them sorted. Safe for concurrent use. |
|
||||
| `pact.MCPSubject` | The identity an MCP session acts as under one guard: guard name, user id, granted scopes, OAuth client id and personal token id. |
|
||||
|
||||
@@ -71,7 +71,10 @@ type MCPTool struct {
|
||||
// MCPPrompt is one MCP prompt template. Name is prefixed and checked like a
|
||||
// tool name; Guard and Permissions filter who is offered it, as for a tool.
|
||||
// Render builds the messages for the given arguments (missing required
|
||||
// arguments are refused before Render runs).
|
||||
// arguments are refused before Render runs). Writes says the prompt directs
|
||||
// tools that are not read-only, so the endpoint lists it only for an
|
||||
// identity that may write, under the same read/write ceiling as such a
|
||||
// tool; false (the zero value) offers it to read-only grants too.
|
||||
type MCPPrompt struct {
|
||||
Name string
|
||||
Title string
|
||||
@@ -80,6 +83,7 @@ type MCPPrompt struct {
|
||||
Permissions []string
|
||||
Arguments []MCPPromptArgument
|
||||
Render func(ctx context.Context, args map[string]string) ([]MCPPromptMessage, error)
|
||||
Writes bool
|
||||
}
|
||||
|
||||
// MCPPromptArgument describes one argument of a prompt.
|
||||
|
||||
Reference in New Issue
Block a user