Skip to content

Commit e872af7

Browse files
author
Brandon Hansen
committed
add pagination
1 parent 13c998c commit e872af7

File tree

5 files changed

+49
-30
lines changed

5 files changed

+49
-30
lines changed

internal/twdesk/priorities.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ func PriorityGet(client *deskclient.Client) server.ServerTool {
5353

5454
// PriorityList returns a list of priorities that apply to the filters in Teamwork Desk
5555
func PriorityList(client *deskclient.Client) server.ServerTool {
56+
opts := []mcp.ToolOption{
57+
mcp.WithDescription("List all priorities in Teamwork Desk"),
58+
mcp.WithArray("name", mcp.Description("The name of the priority to filter by.")),
59+
mcp.WithArray("color", mcp.Description("The color of the priority to filter by.")),
60+
}
61+
62+
opts = append(opts, paginationOptions()...)
63+
5664
return server.ServerTool{
57-
Tool: mcp.NewTool(string(MethodPriorityList),
58-
mcp.WithDescription("List all priorities in Teamwork Desk"),
59-
mcp.WithArray("name", mcp.Description("The name of the priority to filter by.")),
60-
mcp.WithArray("color", mcp.Description("The color of the priority to filter by.")),
61-
),
65+
Tool: mcp.NewTool(string(MethodPriorityList), opts...),
6266
Handler: func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
6367
// Apply filters to the priority list
6468
name := request.GetStringSlice("name", []string{})

internal/twdesk/statuses.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ func StatusGet(client *deskclient.Client) server.ServerTool {
5353

5454
// StatusList returns a list of statuses that apply to the filters in Teamwork Desk
5555
func StatusList(client *deskclient.Client) server.ServerTool {
56+
opts := []mcp.ToolOption{
57+
mcp.WithDescription("List all statuses in Teamwork Desk"),
58+
mcp.WithArray("name", mcp.Description("The name of the status to filter by.")),
59+
mcp.WithArray("color", mcp.Description("The color of the status to filter by.")),
60+
mcp.WithArray("code", mcp.Description("The code of the status to filter by.")),
61+
}
62+
63+
opts = append(opts, paginationOptions()...)
64+
5665
return server.ServerTool{
57-
Tool: mcp.NewTool(string(MethodStatusList),
58-
mcp.WithDescription("List all statuses in Teamwork Desk"),
59-
mcp.WithArray("name", mcp.Description("The name of the status to filter by.")),
60-
mcp.WithArray("color", mcp.Description("The color of the status to filter by.")),
61-
mcp.WithArray("code", mcp.Description("The code of the status to filter by.")),
62-
),
66+
Tool: mcp.NewTool(string(MethodStatusList), opts...),
6367
Handler: func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
6468
// Apply filters to the status list
6569
name := request.GetStringSlice("name", []string{})

internal/twdesk/tags.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ func TagGet(client *deskclient.Client) server.ServerTool {
5353

5454
// TagList returns a list of tags that apply to the filters in Teamwork Desk
5555
func TagList(client *deskclient.Client) server.ServerTool {
56+
opts := []mcp.ToolOption{
57+
mcp.WithDescription("List all tags in Teamwork Desk"),
58+
mcp.WithString("name", mcp.Description("The name of the tag to filter by.")),
59+
mcp.WithString("color", mcp.Description("The color of the tag to filter by.")),
60+
mcp.WithArray("inboxIDs", mcp.Description("The IDs of the inboxes to filter by.")),
61+
}
62+
63+
opts = append(opts, paginationOptions()...)
64+
5665
return server.ServerTool{
57-
Tool: mcp.NewTool(string(MethodTagList),
58-
mcp.WithDescription("List all tags in Teamwork Desk"),
59-
mcp.WithString("name", mcp.Description("The name of the tag to filter by.")),
60-
mcp.WithString("color", mcp.Description("The color of the tag to filter by.")),
61-
mcp.WithArray("inboxIDs", mcp.Description("The IDs of the inboxes to filter by.")),
62-
),
66+
Tool: mcp.NewTool(string(MethodTagList), opts...),
6367
Handler: func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
6468
// Apply filters to the tag list
6569
name := request.GetString("name", "")

internal/twdesk/types.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,15 @@ func TypeGet(client *deskclient.Client) server.ServerTool {
5353

5454
// TypeList returns a list of types that apply to the filters in Teamwork Desk
5555
func TypeList(client *deskclient.Client) server.ServerTool {
56+
opts := []mcp.ToolOption{
57+
mcp.WithDescription("List all types in Teamwork Desk"),
58+
mcp.WithArray("name", mcp.Description("The name of the type to filter by.")),
59+
mcp.WithArray("inboxIDs", mcp.Description("The inbox IDs of the type to filter by.")),
60+
}
61+
62+
opts = append(opts, paginationOptions()...)
5663
return server.ServerTool{
57-
Tool: mcp.NewTool(string(MethodTypeList),
58-
mcp.WithDescription("List all types in Teamwork Desk"),
59-
mcp.WithArray("name", mcp.Description("The name of the type to filter by.")),
60-
mcp.WithArray("inboxIDs", mcp.Description("The inbox IDs of the type to filter by.")),
61-
),
64+
Tool: mcp.NewTool(string(MethodTypeList), opts...),
6265
Handler: func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
6366
// Apply filters to the type list
6467
name := request.GetStringSlice("name", []string{})

internal/twdesk/users.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,19 @@ func UserGet(client *deskclient.Client) server.ServerTool {
4848

4949
// UserList returns a list of users that apply to the filters in Teamwork Desk
5050
func UserList(client *deskclient.Client) server.ServerTool {
51+
opts := []mcp.ToolOption{
52+
mcp.WithDescription("List all users in Teamwork Desk"),
53+
mcp.WithArray("firstName", mcp.Description("The first names of the users to filter by.")),
54+
mcp.WithArray("lastName", mcp.Description("The last names of the users to filter by.")),
55+
mcp.WithArray("email", mcp.Description("The email addresses of the users to filter by.")),
56+
mcp.WithArray("inboxIDs", mcp.Description("The IDs of the inboxes to filter by.")),
57+
mcp.WithBoolean("isPartTime", mcp.Description("Whether to include part-time users in the results.")),
58+
}
59+
60+
opts = append(opts, paginationOptions()...)
61+
5162
return server.ServerTool{
52-
Tool: mcp.NewTool(string(MethodUserList),
53-
mcp.WithDescription("List all users in Teamwork Desk"),
54-
mcp.WithArray("firstName", mcp.Description("The first names of the users to filter by.")),
55-
mcp.WithArray("lastName", mcp.Description("The last names of the users to filter by.")),
56-
mcp.WithArray("email", mcp.Description("The email addresses of the users to filter by.")),
57-
mcp.WithArray("inboxIDs", mcp.Description("The IDs of the inboxes to filter by.")),
58-
mcp.WithBoolean("isPartTime", mcp.Description("Whether to include part-time users in the results.")),
59-
),
63+
Tool: mcp.NewTool(string(MethodUserList), opts...),
6064
Handler: func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
6165
// Apply filters to the user list
6266
firstNames := request.GetStringSlice("firstName", []string{})

0 commit comments

Comments
 (0)