Skip to content

Commit e3f900d

Browse files
authored
[release-v1.17] fix mcp create tool. removed --path (#1393)
1 parent 40e6016 commit e3f900d

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

pkg/mcp/tools_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type CreateInput struct {
4242
}
4343

4444
func (i CreateInput) Args() []string {
45-
args := []string{"-l", i.Language, "--path", i.Path}
45+
args := []string{"-l", i.Language, i.Path}
4646

4747
// Optional
4848
args = appendStringFlag(args, "--template", i.Template)

pkg/mcp/tools_create_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ func TestTool_Create_Args(t *testing.T) {
1919
flag string
2020
value string
2121
}{
22-
"path": {"path", "--path", "."},
2322
"template": {"template", "--template", "cloudevents"},
2423
"repository": {"repository", "--repository", "https://example.com/repo"},
2524
}
@@ -30,15 +29,16 @@ func TestTool_Create_Args(t *testing.T) {
3029

3130
// Required fields
3231
language := "go"
32+
path := "."
3333

3434
executor := mock.NewExecutor()
3535
executor.ExecuteFn = func(ctx context.Context, subcommand string, args ...string) ([]byte, error) {
3636
if subcommand != "create" {
3737
t.Fatalf("expected subcommand 'create', got %q", subcommand)
3838
}
3939

40-
// Expected: 1 required string flag (-l) + stringFlags + boolFlags
41-
if len(args) != (1+len(stringFlags))*2+len(boolFlags) {
40+
// Expected: 1 required string flag (-l) + stringFlags + boolFlags + 1 (positional path arg)
41+
if len(args) != (1+len(stringFlags))*2+len(boolFlags)+1 {
4242
t.Fatalf("expected %d args, got %d: %v", (1+len(stringFlags))*2+len(boolFlags), len(args), args)
4343
}
4444

@@ -65,6 +65,7 @@ func TestTool_Create_Args(t *testing.T) {
6565
// Build input arguments from test data
6666
inputArgs := buildInputArgs(stringFlags, boolFlags)
6767
inputArgs["language"] = language
68+
inputArgs["path"] = path
6869

6970
// Invoke tool with all arguments
7071
result, err := client.CallTool(context.Background(), &mcp.CallToolParams{

0 commit comments

Comments
 (0)