mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2026-03-26 23:05:12 +00:00
Add missing tool parameters from Gitea SDK (#164)
Expose additional parameters that the Gitea SDK supports but were not yet wired through the MCP tool definitions. **Motivation:** Systematic comparison against github-mcp-server and the Gitea SDK revealed several supported parameters that were missing from tool schemas. - `list_issues`: `labels`, `since`, `before` filters - `issue_write`: `labels` and `deadline` on create, `deadline`/`remove_deadline` on update - `pull_request_write`: `labels`/`deadline` on create/update, `remove_deadline` on update, `force_merge`/`merge_when_checks_succeed`/`head_commit_id` on merge - `list_branches`: `page`/`perPage` pagination - `create_repo`: `trust_model`, `object_format_name` - `label_write`: `is_archived` on create/edit **Testing:** Added tests for issue list filters, issue create labels/deadline, PR create labels/deadline, and PR merge new params. Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/164 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: silverwind <me@silverwind.io> Co-committed-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -47,6 +47,7 @@ var (
|
||||
mcp.WithString("color", mcp.Description("label color hex code e.g. #RRGGBB (required for create, optional for edit)")),
|
||||
mcp.WithString("description", mcp.Description("label description")),
|
||||
mcp.WithBoolean("exclusive", mcp.Description("whether the label is exclusive (org labels only)")),
|
||||
mcp.WithBoolean("is_archived", mcp.Description("whether the label is archived (for create/edit repo label methods)")),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -178,10 +179,13 @@ func createRepoLabelFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallT
|
||||
}
|
||||
description, _ := req.GetArguments()["description"].(string) // Optional
|
||||
|
||||
isArchived, _ := req.GetArguments()["is_archived"].(bool)
|
||||
|
||||
opt := gitea_sdk.CreateLabelOption{
|
||||
Name: name,
|
||||
Color: color,
|
||||
Description: description,
|
||||
IsArchived: isArchived,
|
||||
}
|
||||
|
||||
client, err := gitea.ClientFromContext(ctx)
|
||||
@@ -220,6 +224,9 @@ func editRepoLabelFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToo
|
||||
if description, ok := req.GetArguments()["description"].(string); ok {
|
||||
opt.Description = new(description)
|
||||
}
|
||||
if isArchived, ok := req.GetArguments()["is_archived"].(bool); ok {
|
||||
opt.IsArchived = &isArchived
|
||||
}
|
||||
|
||||
client, err := gitea.ClientFromContext(ctx)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user