mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2026-03-25 14:25:13 +00:00
Add missing tool parameters from Gitea SDK
Expose additional parameters that the Gitea SDK supports but were not yet wired through the MCP tool definitions: - 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 Also adds params.GetOptionalTime helper for RFC3339 timestamp parsing and tests for the most important new parameters. Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
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