Trim tool schemas, add param aliases, new PR methods (#191)
- Tool list size reduced by 26.6% (43,032 → 31,599 bytes on the `tools/list` JSON-RPC response). - Trim redundant tool/param descriptions; shared description constants for `owner`/`repo`/`page`/`per_page`. - Schemas now use github-mcp-server param names directly: `issue_number` (was `index` on issue tools), `pull_number` (was `index` on PR tools), `path` (was `filePath`), `query` (was `keyword` on user/repo search), `per_page` (was `perPage`). - New PR read methods `get_files` and `get_status`; new PR write method `update_branch` (update PR branch from base). - `list_org_repos` now uses `per_page` (was `pageSize`). - `milestone_write` accepts `update` and `edit`. - `create_branch` `old_branch` is optional; Gitea defaults to the repo default branch. - Fix `list_commits` handler to honour optional `page`/`per_page` schema (was erroring out when callers omitted them). --- This PR was written with the help of Claude Opus 4.7 Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/191 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:
+21
-21
@@ -28,33 +28,33 @@ const (
|
||||
var (
|
||||
ActionsRunReadTool = mcp.NewTool(
|
||||
ActionsRunReadToolName,
|
||||
mcp.WithDescription("Read Actions workflow, run, and job data. Use method 'list_workflows'/'get_workflow' for workflows, 'list_runs'/'get_run' for runs, 'list_jobs'/'list_run_jobs' for jobs, 'get_job_log_preview'/'download_job_log' for logs."),
|
||||
mcp.WithDescription("Read Actions workflows, runs, jobs, and logs."),
|
||||
mcp.WithToolAnnotation(annotation.ReadOnly("Read Actions workflow, run, and job data")),
|
||||
mcp.WithString("method", mcp.Required(), mcp.Description("operation to perform"), mcp.Enum("list_workflows", "get_workflow", "list_runs", "get_run", "list_jobs", "list_run_jobs", "get_job_log_preview", "download_job_log")),
|
||||
mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")),
|
||||
mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")),
|
||||
mcp.WithString("workflow_id", mcp.Description("workflow ID or filename (required for 'get_workflow')")),
|
||||
mcp.WithNumber("run_id", mcp.Description("run ID (required for 'get_run', 'list_run_jobs')")),
|
||||
mcp.WithNumber("job_id", mcp.Description("job ID (required for 'get_job_log_preview', 'download_job_log')")),
|
||||
mcp.WithString("status", mcp.Description("optional status filter (for 'list_runs', 'list_jobs')")),
|
||||
mcp.WithNumber("tail_lines", mcp.Description("number of lines from end of log (for 'get_job_log_preview')"), mcp.DefaultNumber(200), mcp.Min(1)),
|
||||
mcp.WithNumber("max_bytes", mcp.Description("max bytes to return (for 'get_job_log_preview')"), mcp.DefaultNumber(65536), mcp.Min(1024)),
|
||||
mcp.WithString("output_path", mcp.Description("output file path (for 'download_job_log')")),
|
||||
mcp.WithNumber("page", mcp.Description("page number"), mcp.DefaultNumber(1), mcp.Min(1)),
|
||||
mcp.WithNumber("perPage", mcp.Description("results per page (may be capped by the server's MAX_RESPONSE_ITEMS setting, default 50)"), mcp.DefaultNumber(30), mcp.Min(1)),
|
||||
mcp.WithString("method", mcp.Required(), mcp.Enum("list_workflows", "get_workflow", "list_runs", "get_run", "list_jobs", "list_run_jobs", "get_job_log_preview", "download_job_log")),
|
||||
mcp.WithString("owner", mcp.Required(), mcp.Description(params.OwnerDesc)),
|
||||
mcp.WithString("repo", mcp.Required(), mcp.Description(params.RepoDesc)),
|
||||
mcp.WithString("workflow_id", mcp.Description("ID or filename (for 'get_workflow')")),
|
||||
mcp.WithNumber("run_id", mcp.Description("for 'get_run'/'list_run_jobs'")),
|
||||
mcp.WithNumber("job_id", mcp.Description("for log methods")),
|
||||
mcp.WithString("status", mcp.Description("filter for 'list_runs'/'list_jobs'")),
|
||||
mcp.WithNumber("tail_lines", mcp.Description("log tail lines"), mcp.DefaultNumber(200), mcp.Min(1)),
|
||||
mcp.WithNumber("max_bytes", mcp.Description("max log bytes"), mcp.DefaultNumber(65536), mcp.Min(1024)),
|
||||
mcp.WithString("output_path", mcp.Description("for 'download_job_log'")),
|
||||
mcp.WithNumber("page", mcp.Description(params.PageDesc), mcp.DefaultNumber(1), mcp.Min(1)),
|
||||
mcp.WithNumber("per_page", mcp.Description(params.PaginationDesc), mcp.DefaultNumber(30), mcp.Min(1)),
|
||||
)
|
||||
|
||||
ActionsRunWriteTool = mcp.NewTool(
|
||||
ActionsRunWriteToolName,
|
||||
mcp.WithDescription("Trigger, cancel, or rerun Actions workflows."),
|
||||
mcp.WithDescription("Write Actions runs: dispatch, cancel, rerun."),
|
||||
mcp.WithToolAnnotation(annotation.Write("Trigger, cancel, or rerun Actions workflows")),
|
||||
mcp.WithString("method", mcp.Required(), mcp.Description("operation to perform"), mcp.Enum("dispatch_workflow", "cancel_run", "rerun_run")),
|
||||
mcp.WithString("owner", mcp.Required(), mcp.Description("repository owner")),
|
||||
mcp.WithString("repo", mcp.Required(), mcp.Description("repository name")),
|
||||
mcp.WithString("workflow_id", mcp.Description("workflow ID or filename (required for 'dispatch_workflow')")),
|
||||
mcp.WithString("ref", mcp.Description("git ref branch or tag (required for 'dispatch_workflow')")),
|
||||
mcp.WithObject("inputs", mcp.Description("workflow inputs object (for 'dispatch_workflow')")),
|
||||
mcp.WithNumber("run_id", mcp.Description("run ID (required for 'cancel_run', 'rerun_run')")),
|
||||
mcp.WithString("method", mcp.Required(), mcp.Enum("dispatch_workflow", "cancel_run", "rerun_run")),
|
||||
mcp.WithString("owner", mcp.Required(), mcp.Description(params.OwnerDesc)),
|
||||
mcp.WithString("repo", mcp.Required(), mcp.Description(params.RepoDesc)),
|
||||
mcp.WithString("workflow_id", mcp.Description("ID or filename (for 'dispatch_workflow')")),
|
||||
mcp.WithString("ref", mcp.Description("branch or tag (for 'dispatch_workflow')")),
|
||||
mcp.WithObject("inputs", mcp.Description("for 'dispatch_workflow'")),
|
||||
mcp.WithNumber("run_id", mcp.Description("for 'cancel_run'/'rerun_run'")),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user