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:
@@ -3,6 +3,7 @@ package params
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// GetString extracts a required string parameter from MCP tool arguments.
|
||||
@@ -101,6 +102,18 @@ func GetInt64Slice(args map[string]any, key string) ([]int64, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// GetOptionalTime extracts an optional RFC3339 timestamp parameter, returning nil if missing or unparseable.
|
||||
func GetOptionalTime(args map[string]any, key string) *time.Time {
|
||||
val, ok := args[key].(string)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
if t, err := time.Parse(time.RFC3339, val); err == nil {
|
||||
return &t
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetOptionalInt extracts an optional integer parameter from MCP tool arguments.
|
||||
// Returns defaultVal if the key is missing or the value cannot be parsed.
|
||||
// Accepts both float64 (JSON number) and string representations.
|
||||
|
||||
Reference in New Issue
Block a user