fix: make API bool parameters in search_repos and list_releases optional (#40) (#44) All checks were successful release-nightly / release-image (push) Successful in 3m2s
All checks were successful
release-nightly / release-image (push) Successful in 3m2s
Fix #40 Left the `mcp.DefaultBool(false)` for `is_draft` and `is_pre_release` in `list_releases`, because I guess they are default, but it's up to the client whether to set them or not. 11e04b5b8d/operation/repo/release.go (L67-L68)
Reviewed-on: #44 Reviewed-by: Bo-Yi Wu (吳柏毅) <appleboy.tw@gmail.com> Co-authored-by: Hubert Wawrzyńczyk <hubert@fit-it.pl> Co-committed-by: Hubert Wawrzyńczyk <hubert@fit-it.pl>
This commit was merged in pull request #44.
This commit is contained in:
@@ -221,8 +221,16 @@ func ListReleasesFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallTool | ||||
if !ok { | ||||
return nil, fmt.Errorf("repo is required") | ||||
} | ||||
isDraft, _ := req.GetArguments()["is_draft"].(bool) | ||||
isPreRelease, _ := req.GetArguments()["is_pre_release"].(bool) | ||||
var pIsDraft *bool | ||||
isDraft, ok := req.GetArguments()["is_draft"].(bool) | ||||
if ok { | ||||
pIsDraft = ptr.To(isDraft) | ||||
} | ||||
var pIsPreRelease *bool | ||||
isPreRelease, ok := req.GetArguments()["is_pre_release"].(bool) | ||||
if ok { | ||||
pIsPreRelease = ptr.To(isPreRelease) | ||||
} | ||||
page, _ := req.GetArguments()["page"].(float64) | ||||
pageSize, _ := req.GetArguments()["pageSize"].(float64) | ||||
| ||||
@@ -231,8 +239,8 @@ func ListReleasesFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallTool | ||||
Page: int(page), | ||||
PageSize: int(pageSize), | ||||
}, | ||||
IsDraft: ptr.To(isDraft), | ||||
IsPreRelease: ptr.To(isPreRelease), | ||||
IsDraft: pIsDraft, | ||||
IsPreRelease: pIsPreRelease, | ||||
}) | ||||
if err != nil { | ||||
return nil, fmt.Errorf("list releases error: %v", err) | ||||
|
@@ -144,8 +144,16 @@ func SearchReposFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolR | ||||
keywordIsTopic, _ := req.GetArguments()["keywordIsTopic"].(bool) | ||||
keywordInDescription, _ := req.GetArguments()["keywordInDescription"].(bool) | ||||
ownerID, _ := req.GetArguments()["ownerID"].(float64) | ||||
isPrivate, _ := req.GetArguments()["isPrivate"].(bool) | ||||
isArchived, _ := req.GetArguments()["isArchived"].(bool) | ||||
var pIsPrivate *bool | ||||
isPrivate, ok := req.GetArguments()["isPrivate"].(bool) | ||||
if ok { | ||||
pIsPrivate = ptr.To(isPrivate) | ||||
} | ||||
var pIsArchived *bool | ||||
isArchived, ok := req.GetArguments()["isArchived"].(bool) | ||||
if ok { | ||||
pIsArchived = ptr.To(isArchived) | ||||
} | ||||
sort, _ := req.GetArguments()["sort"].(string) | ||||
order, _ := req.GetArguments()["order"].(string) | ||||
page, ok := req.GetArguments()["page"].(float64) | ||||
@@ -161,8 +169,8 @@ func SearchReposFn(ctx context.Context, req mcp.CallToolRequest) (*mcp.CallToolR | ||||
KeywordIsTopic: keywordIsTopic, | ||||
KeywordInDescription: keywordInDescription, | ||||
OwnerID: int64(ownerID), | ||||
IsPrivate: ptr.To(isPrivate), | ||||
IsArchived: ptr.To(isArchived), | ||||
IsPrivate: pIsPrivate, | ||||
IsArchived: pIsArchived, | ||||
Sort: sort, | ||||
Order: order, | ||||
ListOptions: gitea_sdk.ListOptions{ | ||||
|
Reference in New Issue
Block a user