Feature: Support for custom items#343
Merged
Merged
Conversation
rafaeljusto
reviewed
May 28, 2026
SDK bump:
- Adopt typed list filters: CustomFieldOrderBy, CustomItemOrderBy,
CustomItemRecordOrderBy, CustomItemSideload, TagItemType, UserType.
- Switch NullableInt64 helpers from projects.* to twapi.* (the types
moved to the SDK root in v1.18.0).
- Drop the order_by knob on list_custom_item_fields — v1.18.0 removed
CustomItemFieldListRequestFilters.OrderBy.
- Realign order_by enums in tool schemas with the SDK's canonical
casing (lowercase for *OrderBy, uppercase for TagItemType).
Cache fixes:
- Scope the field-schema cache by {installationID, customItemID}.
customItemID is only unique within an installation; the previous
bare-int64 key let two tenants with the same id collide and read or
write each other's field schema.
- Replace the mutex-backed map with a sync.Map plus an opportunistic
sweep gated by a 5-minute CAS, so expired entries actually leave
memory instead of accumulating forever.
- installationID comes from request.InfoFromContext; under STDIO it
collapses to 0 (single-tenant process), which is the correct key.
Refactor:
- Move the cache into internal/twprojects/custom_item_fields_resolver.go
with customItemField-prefixed names (customItemFieldCache,
customItemFieldCacheKey, resolveCustomItemFields, etc.) to keep it
out of custom_item_fields.go's tool definitions.
- Add tests covering tenant-key scoping, STDIO fallback, sweep
eviction, and the sweep rate limit.
Cover create/update/delete/get/list across custom_items.go, custom_item_fields.go, and custom_item_records.go using the existing mcpServerMock pattern. Record create dispatches a field-list GET before the record POST with different expected statuses, so add a ProjectsMCPServerRoutedMock helper in testutil that returns responses based on a substring match against the request path.
rafaeljusto
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Builds on Teamwork/twapi-go-sdk#90 to support Custom Items in the MCP server