Skip to content

Commit 2b5060f

Browse files
author
Zheng Li
committed
https://github.com/mark3labs/mcp-go/pull/35#discussion_r1978726095
1 parent fbac167 commit 2b5060f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mcp/tools.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,14 @@ func (t *Tool) UnmarshalJSON(b []byte) error {
125125

126126
// Try to unmarshal InputSchema into structured format
127127
var schema ToolInputSchema
128-
if err := json.Unmarshal(raw.InputSchema, &schema); err == nil {
128+
if err := json.Unmarshal(raw.InputSchema, &schema); err == nil && schema.Type != "" {
129129
// Successfully parsed structured schema
130130
t.InputSchema = schema
131131
t.RawInputSchema = nil
132132
} else {
133-
return err
133+
// Failed to parse structured schema, use raw schema
134+
t.InputSchema = ToolInputSchema{}
135+
t.RawInputSchema = raw.InputSchema
134136
}
135137

136138
return nil

0 commit comments

Comments
 (0)