Skip to content

Commit 720a04a

Browse files
committed
merge fixup
1 parent 92fc369 commit 720a04a

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

cmd/src/mcp.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
package main
22

33
import (
4+
"context"
5+
"encoding/json"
46
"flag"
57
"fmt"
8+
"strings"
69

10+
"github.com/sourcegraph/src-cli/internal/api"
711
"github.com/sourcegraph/src-cli/internal/mcp"
12+
13+
"github.com/sourcegraph/sourcegraph/lib/errors"
814
)
915

1016
func init() {
@@ -16,7 +22,7 @@ func init() {
1622
}
1723
func mcpMain(args []string) error {
1824
fmt.Println("NOTE: This command is still experimental")
19-
tools, err := mcp.LoadToolDefinitions()
25+
tools, err := mcp.LoadDefaultToolDefinitions()
2026
if err != nil {
2127
return err
2228
}

internal/mcp/mcp_parse.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ func loadToolDefinitions(data []byte) (map[string]*ToolDef, error) {
7272
Tools []struct {
7373
Name string `json:"name"`
7474
Description string `json:"description"`
75-
InputSchema RawSchema `json:"inputSchema"`
76-
OutputSchema RawSchema `json:"outputSchema"`
75+
InputSchema rawSchema `json:"inputSchema"`
76+
OutputSchema rawSchema `json:"outputSchema"`
7777
} `json:"tools"`
7878
}{}
7979

@@ -109,22 +109,21 @@ func loadToolDefinitions(data []byte) (map[string]*ToolDef, error) {
109109

110110
func (d *decoder) decodeRootSchema(r rawSchema) SchemaObject {
111111
return SchemaObject{
112-
Schema: r.SchemaVersion,
113-
Type: r.Type,
114-
Description: r.Description,
115-
Required: r.Required,
116-
Properties: d.decodeProperties(r.Properties),
112+
Type: r.Type,
113+
Description: r.Description,
114+
Required: r.Required,
115+
Properties: d.decodeProperties(r.Properties),
117116
}
118117
}
119118

120119
func (d *decoder) decodeSchema(r *rawSchema) SchemaValue {
121120
switch r.Type {
122121
case "object":
123122
return &SchemaObject{
124-
Type: r.Type,
125-
Description: r.Description,
126-
Required: r.Required,
127-
Properties: d.decodeProperties(r.Properties),
123+
Type: r.Type,
124+
Description: r.Description,
125+
Required: r.Required,
126+
Properties: d.decodeProperties(r.Properties),
128127
}
129128
case "array":
130129
var items SchemaValue

internal/mcp/mcp_parse_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestLoadToolDefinitions(t *testing.T) {
3737
]
3838
}`)
3939

40-
tools, err := LoadToolDefinitions(toolJSON)
40+
tools, err := loadToolDefinitions(toolJSON)
4141
if err != nil {
4242
t.Fatalf("Failed to load tool definitions: %v", err)
4343
}
@@ -46,13 +46,13 @@ func TestLoadToolDefinitions(t *testing.T) {
4646
t.Fatalf("Expected 1 tool, got %d", len(tools))
4747
}
4848

49-
tool := tools["test_tool"]
49+
tool := tools["test-tool"]
5050
if tool == nil {
5151
t.Fatal("Tool 'test_tool' not found")
5252
}
5353

54-
if tool.Name != "test_tool" {
55-
t.Errorf("Expected name 'test_tool', got '%s'", tool.Name)
54+
if tool.RawName != "test_tool" {
55+
t.Errorf("Expected name 'test_tool', got '%s'", tool.RawName)
5656
}
5757

5858
inputSchema := tool.InputSchema

0 commit comments

Comments
 (0)