@@ -281,12 +281,12 @@ type CursorPaginationParams struct {
281281}
282282
283283// ToGraphQLParams converts cursor pagination parameters to GraphQL-specific parameters.
284- func (p CursorPaginationParams ) ToGraphQLParams () (GraphQLPaginationParams , error ) {
284+ func (p CursorPaginationParams ) ToGraphQLParams () (* GraphQLPaginationParams , error ) {
285285 if p .PerPage > 100 {
286- return GraphQLPaginationParams {} , fmt .Errorf ("perPage value %d exceeds maximum of 100" , p .PerPage )
286+ return nil , fmt .Errorf ("perPage value %d exceeds maximum of 100" , p .PerPage )
287287 }
288288 if p .PerPage < 0 {
289- return GraphQLPaginationParams {} , fmt .Errorf ("perPage value %d cannot be negative" , p .PerPage )
289+ return nil , fmt .Errorf ("perPage value %d cannot be negative" , p .PerPage )
290290 }
291291 first := int32 (p .PerPage )
292292
@@ -295,7 +295,7 @@ func (p CursorPaginationParams) ToGraphQLParams() (GraphQLPaginationParams, erro
295295 after = & p .After
296296 }
297297
298- return GraphQLPaginationParams {
298+ return & GraphQLPaginationParams {
299299 First : & first ,
300300 After : after ,
301301 }, nil
@@ -309,24 +309,13 @@ type GraphQLPaginationParams struct {
309309// ToGraphQLParams converts REST API pagination parameters to GraphQL-specific parameters.
310310// This converts page/perPage to first parameter for GraphQL queries.
311311// If After is provided, it takes precedence over page-based pagination.
312- func (p PaginationParams ) ToGraphQLParams () (GraphQLPaginationParams , error ) {
313- if p .PerPage > 100 {
314- return GraphQLPaginationParams {}, fmt .Errorf ("perPage value %d exceeds maximum of 100" , p .PerPage )
315- }
316- if p .PerPage < 0 {
317- return GraphQLPaginationParams {}, fmt .Errorf ("perPage value %d cannot be negative" , p .PerPage )
312+ func (p PaginationParams ) ToGraphQLParams () (* GraphQLPaginationParams , error ) {
313+ // Convert to CursorPaginationParams and delegate to avoid duplication
314+ cursor := CursorPaginationParams {
315+ PerPage : p .PerPage ,
316+ After : p .After ,
318317 }
319- first := int32 (p .PerPage )
320-
321- var after * string
322- if p .After != "" {
323- after = & p .After
324- }
325-
326- return GraphQLPaginationParams {
327- First : & first ,
328- After : after ,
329- }, nil
318+ return cursor .ToGraphQLParams ()
330319}
331320
332321func MarshalledTextResult (v any ) * mcp.CallToolResult {
0 commit comments