stability: validate enum-style string parameters (sort/order/state) #10

Closed
opened 2026-05-23 18:30:52 +00:00 by Klaus · 0 comments
Owner

Problem

Several tools accept open string parameters that the Gitea API only honors for a fixed enum (sort, order, state, type, etc.) — e.g. operation/search/search.go for SearchReposTool. Invalid values are passed through verbatim; Gitea silently ignores them, producing surprising results without any error surfaced to the MCP client.

Suggested direction

  • Use mcp.Enum(...) in the tool schema where the value set is known
  • For values that depend on context, validate post-extraction with an allowlist and return a descriptive MCP error
  • Document the allowed values in the tool description so MCP clients can prompt correctly
## Problem Several tools accept open string parameters that the Gitea API only honors for a fixed enum (`sort`, `order`, `state`, `type`, etc.) — e.g. `operation/search/search.go` for `SearchReposTool`. Invalid values are passed through verbatim; Gitea silently ignores them, producing surprising results without any error surfaced to the MCP client. ## Suggested direction - Use `mcp.Enum(...)` in the tool schema where the value set is known - For values that depend on context, validate post-extraction with an allowlist and return a descriptive MCP error - Document the allowed values in the tool description so MCP clients can prompt correctly
Klaus referenced this issue from a commit 2026-05-23 18:47:28 +00:00
Klaus closed this issue 2026-05-23 18:47:28 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Klaus/gitea-mcp#10