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:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"gitea.com/gitea/gitea-mcp/pkg/annotation"
|
||||
"gitea.com/gitea/gitea-mcp/pkg/gitea"
|
||||
"gitea.com/gitea/gitea-mcp/pkg/log"
|
||||
"gitea.com/gitea/gitea-mcp/pkg/params"
|
||||
@@ -25,6 +26,7 @@ var (
|
||||
CreateTagTool = mcp.NewTool(
|
||||
CreateTagToolName,
|
||||
mcp.WithDescription("Create tag"),
|
||||
mcp.WithToolAnnotation(annotation.Write("Create a tag")),
|
||||
mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")),
|
||||
mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")),
|
||||
mcp.WithString("tag_name", mcp.Required(), mcp.Description("tag name")),
|
||||
@@ -35,6 +37,7 @@ var (
|
||||
DeleteTagTool = mcp.NewTool(
|
||||
DeleteTagToolName,
|
||||
mcp.WithDescription("Delete tag"),
|
||||
mcp.WithToolAnnotation(annotation.Destructive("Delete a tag")),
|
||||
mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")),
|
||||
mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")),
|
||||
mcp.WithString("tag_name", mcp.Required(), mcp.Description("tag name")),
|
||||
@@ -43,6 +46,7 @@ var (
|
||||
GetTagTool = mcp.NewTool(
|
||||
GetTagToolName,
|
||||
mcp.WithDescription("Get tag"),
|
||||
mcp.WithToolAnnotation(annotation.ReadOnly("Get tag details")),
|
||||
mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")),
|
||||
mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")),
|
||||
mcp.WithString("tag_name", mcp.Required(), mcp.Description("tag name")),
|
||||
@@ -51,6 +55,7 @@ var (
|
||||
ListTagsTool = mcp.NewTool(
|
||||
ListTagsToolName,
|
||||
mcp.WithDescription("List tags"),
|
||||
mcp.WithToolAnnotation(annotation.ReadOnly("List tags")),
|
||||
mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")),
|
||||
mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")),
|
||||
mcp.WithNumber("page", mcp.Description("page number"), mcp.DefaultNumber(1), mcp.Min(1)),
|
||||
|
||||
Reference in New Issue
Block a user