Skip to content

Commit 20a05df

Browse files
committed
review feedback
- errors.Wrapf - strings.TrimPrefix
1 parent de877c3 commit 20a05df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/mcp/mcp_parse.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func loadToolDefinitions(data []byte) (map[string]*ToolDef, error) {
8787
for _, t := range defs.Tools {
8888
// normalize the raw mcp tool name to be without the mcp identifiers
8989
rawName := t.Name
90-
name, _ := strings.CutPrefix(rawName, "sg_")
90+
name := strings.TrimPrefix(rawName, "sg_")
9191
name = strings.ReplaceAll(name, "_", "-")
9292

9393
tool := &ToolDef{
@@ -140,7 +140,7 @@ func (d *decoder) decodeSchema(r *RawSchema) SchemaValue {
140140
if err := json.Unmarshal(r.Items, &itemRaw); err == nil {
141141
items = d.decodeSchema(&itemRaw)
142142
} else {
143-
d.errors = append(d.errors, errors.Errorf("failed to unmarshal array items: %w", err))
143+
d.errors = append(d.errors, errors.Wrapf(err, "failed to unmarshal array items"))
144144
}
145145
}
146146
}
@@ -162,7 +162,7 @@ func (d *decoder) decodeProperties(props map[string]json.RawMessage) map[string]
162162
for name, raw := range props {
163163
var r RawSchema
164164
if err := json.Unmarshal(raw, &r); err != nil {
165-
d.errors = append(d.errors, errors.Newf("failed to parse property %q: %w", name, err))
165+
d.errors = append(d.errors, errors.Wrapf(err, "failed to parse property %q", name))
166166
continue
167167
}
168168
res[name] = d.decodeSchema(&r)

0 commit comments

Comments
 (0)