Skip to content

Commit 86fbc85

Browse files
authored
Fix handling nil values for optional string array parameters, (#194)
* Fix handling nil values for optional string array parameters, nil values should be equivalent to an empty string, currently we return an error but Claude passes nil for optional values. * lint fixes
1 parent 56c1fce commit 86fbc85

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pkg/github/issues_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,10 @@ func Test_CreateIssue(t *testing.T) {
468468
),
469469
),
470470
requestArgs: map[string]interface{}{
471-
"owner": "owner",
472-
"repo": "repo",
473-
"title": "Minimal Issue",
471+
"owner": "owner",
472+
"repo": "repo",
473+
"title": "Minimal Issue",
474+
"assignees": nil, // Expect no failure with nil optional value.
474475
},
475476
expectError: false,
476477
expectedIssue: &github.Issue{

pkg/github/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ func OptionalStringArrayParam(r mcp.CallToolRequest, p string) ([]string, error)
238238
}
239239

240240
switch v := r.Params.Arguments[p].(type) {
241+
case nil:
242+
return []string{}, nil
241243
case []string:
242244
return v, nil
243245
case []any:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy