Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit81f093e

Browse files
committed
Inline optional bool function for all notifications
1 parent9424fbd commit81f093e

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

‎pkg/github/notifications.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ func ListNotifications(getClient GetClientFn, t translations.TranslationHelperFu
3636
iferr!=nil {
3737
returnmcp.NewToolResultError(err.Error()),nil
3838
}
39-
all,err:=OptionalBoolParamWithDefault(request,"all",false)// Default to false unless specified
40-
iferr!=nil {
41-
returnmcp.NewToolResultError(err.Error()),nil
39+
all:=false
40+
ifval,err:=OptionalParam[bool](request,"all");err==nil {
41+
all=val
4242
}
4343

4444
opts:=&github.NotificationListOptions{

‎pkg/github/server.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,6 @@ func OptionalIntParam(r mcp.CallToolRequest, p string) (int, error) {
130130
returnint(v),nil
131131
}
132132

133-
// OptionalBoolParamWithDefault is a helper function that retrieves a boolean parameter from the request.
134-
// If the parameter is not present, it returns the provided default value. If the parameter is present,
135-
// it validates its type and returns the value.
136-
funcOptionalBoolParamWithDefault(request mcp.CallToolRequest,sstring,bbool) (bool,error) {
137-
v,err:=OptionalParam[bool](request,s)
138-
iferr!=nil {
139-
returnfalse,err
140-
}
141-
if!b {
142-
returnb,nil
143-
}
144-
returnv,nil
145-
}
146-
147133
// OptionalIntParamWithDefault is a helper function that can be used to fetch a requested parameter from the request
148134
// similar to optionalIntParam, but it also takes a default value.
149135
funcOptionalIntParamWithDefault(r mcp.CallToolRequest,pstring,dint) (int,error) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp