@@ -18,6 +18,7 @@ import {
1818 generateDefaultValue ,
1919 isPropertyRequired ,
2020 normalizeUnionType ,
21+ resolveRef ,
2122} from "@/utils/schemaUtils" ;
2223import {
2324 CompatibilityCallToolResult ,
@@ -97,14 +98,21 @@ const ToolsTab = ({
9798 useEffect ( ( ) => {
9899 const params = Object . entries (
99100 selectedTool ?. inputSchema . properties ?? [ ] ,
100- ) . map ( ( [ key , value ] ) => [
101- key ,
102- generateDefaultValue (
101+ ) . map ( ( [ key , value ] ) => {
102+ // First resolve any $ref references
103+ const resolvedValue = resolveRef (
103104 value as JsonSchemaType ,
104- key ,
105105 selectedTool ?. inputSchema as JsonSchemaType ,
106- ) ,
107- ] ) ;
106+ ) ;
107+ return [
108+ key ,
109+ generateDefaultValue (
110+ resolvedValue ,
111+ key ,
112+ selectedTool ?. inputSchema as JsonSchemaType ,
113+ ) ,
114+ ] ;
115+ } ) ;
108116 setParams ( Object . fromEntries ( params ) ) ;
109117
110118 // Reset validation errors when switching tools
@@ -161,7 +169,12 @@ const ToolsTab = ({
161169 </ p >
162170 { Object . entries ( selectedTool . inputSchema . properties ?? [ ] ) . map (
163171 ( [ key , value ] ) => {
164- const prop = normalizeUnionType ( value as JsonSchemaType ) ;
172+ // First resolve any $ref references
173+ const resolvedValue = resolveRef (
174+ value as JsonSchemaType ,
175+ selectedTool . inputSchema as JsonSchemaType ,
176+ ) ;
177+ const prop = normalizeUnionType ( resolvedValue ) ;
165178 const inputSchema =
166179 selectedTool . inputSchema as JsonSchemaType ;
167180 const required = isPropertyRequired ( key , inputSchema ) ;
0 commit comments