Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ require (
github.com/creack/pty v1.1.24
github.com/fsnotify/fsnotify v1.9.0
github.com/goccy/go-yaml v1.18.0
github.com/google/jsonschema-go v0.2.1-0.20250825175020-748c325cec76
github.com/google/jsonschema-go v0.3.0
github.com/mattn/go-isatty v0.0.20
github.com/modelcontextprotocol/go-sdk v0.4.0
github.com/modelcontextprotocol/go-sdk v1.1.0
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2
github.com/sourcegraph/conc v0.3.0
github.com/spf13/cobra v1.10.1
Expand Down Expand Up @@ -57,6 +57,7 @@ require (
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/oauth2 v0.30.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/jsonschema-go v0.2.1-0.20250825175020-748c325cec76 h1:mBlBwtDebdDYr+zdop8N62a44g+Nbv7o2KjWyS1deR4=
github.com/google/jsonschema-go v0.2.1-0.20250825175020-748c325cec76/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
github.com/google/jsonschema-go v0.3.0 h1:6AH2TxVNtk3IlvkkhjrtbUc4S8AvO0Xii0DxIygDg+Q=
github.com/google/jsonschema-go v0.3.0/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
github.com/henvic/httpretty v0.1.4 h1:Jo7uwIRWVFxkqOnErcoYfH90o3ddQyVrSANeS4cxYmU=
github.com/henvic/httpretty v0.1.4/go.mod h1:Dn60sQTZfbt2dYsdUSNsCljyF4AfdqnuJFDLJA1I4AM=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand All @@ -94,8 +94,8 @@ github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byF
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
github.com/modelcontextprotocol/go-sdk v0.4.0 h1:RJ6kFlneHqzTKPzlQqiunrz9nbudSZcYLmLHLsokfoU=
github.com/modelcontextprotocol/go-sdk v0.4.0/go.mod h1:whv0wHnsTphwq7CTiKYHkLtwLC06WMoY2KpO+RB9yXQ=
github.com/modelcontextprotocol/go-sdk v1.1.0 h1:Qjayg53dnKC4UZ+792W21e4BpwEZBzwgRW6LrjLWSwA=
github.com/modelcontextprotocol/go-sdk v1.1.0/go.mod h1:6fM3LCm3yV7pAs8isnKLn07oKtB0MP9LHd3DfAcKw10=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
Expand Down Expand Up @@ -140,6 +140,8 @@ go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
28 changes: 9 additions & 19 deletions pkg/cli/mcp_server_add_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,31 +182,21 @@ func TestMCPServer_AddToolInvocation(t *testing.T) {

// Test 2: Call with missing workflows parameter (should fail)
t.Run("MissingWorkflows", func(t *testing.T) {
callResult, err := session.CallTool(ctx, &mcp.CallToolParams{
_, err := session.CallTool(ctx, &mcp.CallToolParams{
Name: "add",
Arguments: map[string]any{},
})

if err != nil {
t.Fatalf("Failed to call add tool: %v", err)
}

// Verify we got error output
if len(callResult.Content) == 0 {
t.Fatal("add tool returned no content")
}

// Extract text content
var outputText string
for _, content := range callResult.Content {
if textContent, ok := content.(*mcp.TextContent); ok {
outputText += textContent.Text
}
// MCP SDK v1.1.0 validates parameters before calling the tool,
// so we expect an error from CallTool itself
if err == nil {
t.Fatal("Expected error when calling add tool with missing workflows parameter")
}

// Should contain error message
if !strings.Contains(outputText, "Error") && !strings.Contains(outputText, "error") && !strings.Contains(outputText, "required") {
t.Errorf("Expected error message for missing workflows, got: %s", outputText)
// Verify the error message mentions the missing required parameter
errMsg := err.Error()
if !strings.Contains(errMsg, "workflows") && !strings.Contains(errMsg, "required") {
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message validation logic is incorrect. The condition uses && (AND) when it should use || (OR). The current logic only fails the test if the error message contains NEITHER "workflows" NOR "required", meaning the test would pass even if the error message only contains one of them. This makes the assertion too weak.

The condition should be:

if !strings.Contains(errMsg, "workflows") || !strings.Contains(errMsg, "required") {

Or better yet, use a single check that the error mentions the parameter name:

if !strings.Contains(errMsg, "workflows") {
    t.Errorf("Expected error message to mention missing 'workflows' parameter, got: %s", errMsg)
}
Suggested change
if !strings.Contains(errMsg, "workflows") && !strings.Contains(errMsg, "required") {
if !strings.Contains(errMsg, "workflows") {

Copilot uses AI. Check for mistakes.
t.Errorf("Expected error message to mention missing 'workflows' parameter, got: %s", errMsg)
}
})
}
Loading