Many tools in operation/* follow the same shape: a single *_read / *_write tool with a method enum that fans out to ~5–10 sub-handlers. The fan-out is reimplemented per module — each does its own switch, its own param extraction, its own error wrapping. Adding a new common behavior (e.g. consistent logging, pagination caps, the %w sweep) requires editing the same shape dozens of times.
Each module registers a map[string]MethodHandler instead of a hand-rolled switch. Cross-cutting concerns (logging, validation, error wrapping) live in the dispatcher, applied once.
## Problem
Many tools in `operation/*` follow the same shape: a single `*_read` / `*_write` tool with a `method` enum that fans out to ~5–10 sub-handlers. The fan-out is reimplemented per module — each does its own switch, its own param extraction, its own error wrapping. Adding a new common behavior (e.g. consistent logging, pagination caps, the `%w` sweep) requires editing the same shape dozens of times.
Examples: `operation/issue/issue.go`, `operation/label/label.go`, `operation/milestone/milestone.go`, `operation/repo/*`, `operation/pull/pull.go`.
## Suggested direction
Introduce a small dispatcher in `pkg/tool`:
```go
type MethodHandler func(ctx, req) (*mcp.Result, error)
func Dispatch(handlers map[string]MethodHandler) ToolFn { ... }
```
Each module registers a `map[string]MethodHandler` instead of a hand-rolled switch. Cross-cutting concerns (logging, validation, error wrapping) live in the dispatcher, applied once.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
Many tools in
operation/*follow the same shape: a single*_read/*_writetool with amethodenum that fans out to ~5–10 sub-handlers. The fan-out is reimplemented per module — each does its own switch, its own param extraction, its own error wrapping. Adding a new common behavior (e.g. consistent logging, pagination caps, the%wsweep) requires editing the same shape dozens of times.Examples:
operation/issue/issue.go,operation/label/label.go,operation/milestone/milestone.go,operation/repo/*,operation/pull/pull.go.Suggested direction
Introduce a small dispatcher in
pkg/tool:Each module registers a
map[string]MethodHandlerinstead of a hand-rolled switch. Cross-cutting concerns (logging, validation, error wrapping) live in the dispatcher, applied once.