Skip to content

Refactor: Add shared schema helpers for pagination, tag, and search params#306

Merged
tw-garymeehan merged 2 commits into
mainfrom
gary/shared-schema-helpers
May 6, 2026
Merged

Refactor: Add shared schema helpers for pagination, tag, and search params#306
tw-garymeehan merged 2 commits into
mainfrom
gary/shared-schema-helpers

Conversation

@tw-garymeehan
Copy link
Copy Markdown
Contributor

Summary

  • New internal/helpers/schema.go with 9 building-block helpers (PageSchema, PageSizeSchema, PageOffsetSchema, OrderBySchema, OrderDirectionSchema, SearchTermSchema, TagIDsFilterSchema, TagIDsAssociateSchema, MatchAllTagsSchema).
  • Replaces inline schema literals across 24 twprojects files plus the paginationOptions wrappers in twdesk and twspaces.
  • Net diff: +96 / −687 lines, no behavioural change. Token delta vs main: −6 (essentially flat — descriptions normalised, not removed).

Notes

  • Minor wording normalisation in twdesk/twspaces (e.g. "The page number to retrieve." → "Page number for pagination of results.") to align all modules on twprojects' phrasing.
  • Multi-line search_term blocks in 11 files were left untouched because they carry entity-specific extra wording that flattening would lose.
  • IDParam and DateRangeParams from the original plan were dropped — descriptions vary too much for a clean shared helper. Better suited to PR 4.

Part of the tool description simplification effort. Follows #293, #303.

Test plan

  • gofmt -s -w .
  • go vet ./...
  • go test ./...
  • go run ./cmd/mcp-tokens -base main (delta: −6)

🤖 Generated with Claude Code

…arams

Deduplicates JSON-schema property literals across twprojects (24 files),
twdesk and twspaces. New helpers in internal/helpers/schema.go:
PageSchema, PageSizeSchema, PageOffsetSchema, OrderBySchema,
OrderDirectionSchema, SearchTermSchema, TagIDsFilterSchema,
TagIDsAssociateSchema, MatchAllTagsSchema. Existing module-local
paginationOptions wrappers in twdesk/twspaces now consume the helpers.
Net change: +96 / -687 lines, no behavioural change. Token delta vs
main: -6 (essentially flat).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tw-garymeehan tw-garymeehan requested a review from a team as a code owner May 6, 2026 13:39
Comment thread internal/helpers/schema.go Outdated
Per PR review feedback. Surfaces the allowed values directly in the
schema rather than only in the description, matching the codebase's
existing enum pattern (e.g. priority in tasks.go).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tw-garymeehan tw-garymeehan merged commit e97e82e into main May 6, 2026
3 checks passed
@tw-garymeehan tw-garymeehan deleted the gary/shared-schema-helpers branch May 6, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants