Add tool annotations and PR close/reopen support (#174)
Add MCP `ToolAnnotation` metadata (Title, ReadOnlyHint, DestructiveHint) to all registered tools so MCP hosts (VS Code, Claude, Cursor) get accurate per-tool hints. A shared `pkg/annotation` package exposes `ReadOnly`, `Write`, and `Destructive` helpers for consistency. Add `close` and `reopen` methods to `pull_request_write` so PR state can be toggled without going through the generic `update` path. Co-Authored-By: silverwind <me@silverwind.io> Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
// Package annotation provides shared MCP tool annotation helpers.
|
||||
package annotation
|
||||
|
||||
import "github.com/mark3labs/mcp-go/mcp"
|
||||
|
||||
// ReadOnly returns a ToolAnnotation for read-only tools.
|
||||
func ReadOnly(title string) mcp.ToolAnnotation {
|
||||
t := true
|
||||
return mcp.ToolAnnotation{
|
||||
Title: title,
|
||||
ReadOnlyHint: &t,
|
||||
}
|
||||
}
|
||||
|
||||
// Write returns a ToolAnnotation for write tools.
|
||||
func Write(title string) mcp.ToolAnnotation {
|
||||
f := false
|
||||
return mcp.ToolAnnotation{
|
||||
Title: title,
|
||||
ReadOnlyHint: &f,
|
||||
}
|
||||
}
|
||||
|
||||
// Destructive returns a ToolAnnotation for destructive write tools.
|
||||
func Destructive(title string) mcp.ToolAnnotation {
|
||||
f, t := false, true
|
||||
return mcp.ToolAnnotation{
|
||||
Title: title,
|
||||
ReadOnlyHint: &f,
|
||||
DestructiveHint: &t,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user