fix: pass body through in create_release (#82)

### What
Ensure `create_release` accepts and forwards a `body` so release notes are created as provided.

### Why
Previously, the `body` parameter wasn’t threaded through, resulting in empty release notes even when a body was supplied.

### How
- Add `body` parameter to the function signature
- Thread `body` through handler/service to the API call
- Light refactor for clarity; no breaking changes

### Testing
- Manual: created a release with a non-empty body and confirmed it appears in the UI and in the releases API response

### Links
Fixes gitea/gitea-mcp#81

Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/82
Reviewed-by: hiifong <i@hiif.ong>
Co-authored-by: meestark <meestark@meestark.net>
Co-committed-by: meestark <meestark@meestark.net>
This commit is contained in:
meestark
2025-08-11 01:07:52 +00:00
committed by hiifong
parent a601d6b698
commit feaedaf604

View File

@@ -34,6 +34,7 @@ var (
mcp.WithString("title", mcp.Required(), mcp.Description("release title")), mcp.WithString("title", mcp.Required(), mcp.Description("release title")),
mcp.WithBoolean("is_draft", mcp.Description("Whether the release is draft"), mcp.DefaultBool(false)), mcp.WithBoolean("is_draft", mcp.Description("Whether the release is draft"), mcp.DefaultBool(false)),
mcp.WithBoolean("is_pre_release", mcp.Description("Whether the release is pre-release"), mcp.DefaultBool(false)), mcp.WithBoolean("is_pre_release", mcp.Description("Whether the release is pre-release"), mcp.DefaultBool(false)),
mcp.WithString("body", mcp.Description("release body")),
) )
DeleteReleaseTool = mcp.NewTool( DeleteReleaseTool = mcp.NewTool(
@@ -131,11 +132,13 @@ func CreateReleaseFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToo
} }
isDraft, _ := req.GetArguments()["is_draft"].(bool) isDraft, _ := req.GetArguments()["is_draft"].(bool)
isPreRelease, _ := req.GetArguments()["is_pre_release"].(bool) isPreRelease, _ := req.GetArguments()["is_pre_release"].(bool)
body, _ := req.GetArguments()["body"].(string)
_, _, err := gitea.Client().CreateRelease(owner, repo, gitea_sdk.CreateReleaseOption{ _, _, err := gitea.Client().CreateRelease(owner, repo, gitea_sdk.CreateReleaseOption{
TagName: tagName, TagName: tagName,
Target: target, Target: target,
Title: title, Title: title,
Note: body,
IsDraft: isDraft, IsDraft: isDraft,
IsPrerelease: isPreRelease, IsPrerelease: isPreRelease,
}) })