Skip to content

Commit 2d1ac17

Browse files
committed
fixup
1 parent d986b9f commit 2d1ac17

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

internal/mcp/mcp_parse.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,6 @@ func loadToolDefinitions(data []byte) (map[string]*ToolDef, error) {
105105
tools[tool.Name] = tool
106106
}
107107

108-
// make it so that can find a tool definition by it's original name (RawName) and normalized name (Name())
109-
tools[def.RawName] = def
110-
tools[def.Name()] = def
111-
112108
if len(decoder.errors) > 0 {
113109
return tools, errors.Append(nil, decoder.errors...)
114110
}
@@ -129,15 +125,15 @@ func (d *decoder) decodeRootSchema(r RawSchema) Schema {
129125
}
130126
}
131127

132-
func (p *decoder) decodeSchema(r *RawSchema) SchemaValue {
128+
func (d *decoder) decodeSchema(r *RawSchema) SchemaValue {
133129
switch r.Type {
134130
case "object":
135131
return &SchemaObject{
136132
Kind: r.Type,
137133
Description: r.Description,
138134
Required: r.Required,
139135
AdditionalProperties: r.AdditionalProperties,
140-
Properties: p.decodeProperties(r.Properties),
136+
Properties: d.decodeProperties(r.Properties),
141137
}
142138
case "array":
143139
var items SchemaValue
@@ -149,9 +145,9 @@ func (p *decoder) decodeSchema(r *RawSchema) SchemaValue {
149145
} else {
150146
var itemRaw RawSchema
151147
if err := json.Unmarshal(r.Items, &itemRaw); err == nil {
152-
items = p.decodeSchema(&itemRaw)
148+
items = d.decodeSchema(&itemRaw)
153149
} else {
154-
p.errors = append(p.errors, errors.Errorf("failed to unmarshal array items: %w", err))
150+
d.errors = append(d.errors, errors.Errorf("failed to unmarshal array items: %w", err))
155151
}
156152
}
157153
}
@@ -168,15 +164,15 @@ func (p *decoder) decodeSchema(r *RawSchema) SchemaValue {
168164
}
169165
}
170166

171-
func (p *decoder) decodeProperties(props map[string]json.RawMessage) map[string]SchemaValue {
167+
func (d *decoder) decodeProperties(props map[string]json.RawMessage) map[string]SchemaValue {
172168
res := make(map[string]SchemaValue)
173169
for name, raw := range props {
174170
var r RawSchema
175171
if err := json.Unmarshal(raw, &r); err != nil {
176-
p.errors = append(p.errors, errors.Newf("failed to parse property %q: %w", name, err))
172+
d.errors = append(d.errors, errors.Newf("failed to parse property %q: %w", name, err))
177173
continue
178174
}
179-
res[name] = p.decodeSchema(&r)
175+
res[name] = d.decodeSchema(&r)
180176
}
181177
return res
182178
}

0 commit comments

Comments
 (0)