@@ -4484,33 +4484,53 @@ async function testTool(toolId) {
4484
4484
const wrapper = document . createElement ( "div" ) ;
4485
4485
wrapper . className = "flex items-center space-x-2" ;
4486
4486
4487
- const input = document . createElement ( "input" ) ;
4488
- input . name = keyValidation . value ;
4489
- input . required =
4490
- schema . required && schema . required . includes ( key ) ;
4491
- input . className =
4492
- "mt-1 block w-full rounded-md border border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:bg-gray-900 text-gray-700 dark:text-gray-300 dark:border-gray-700 dark:focus:border-indigo-400 dark:focus:ring-indigo-400" ;
4493
-
4494
4487
const itemTypes = Array . isArray ( prop . items ?. anyOf )
4495
4488
? prop . items . anyOf . map ( ( t ) => t . type )
4496
4489
: [ prop . items ?. type ] ;
4497
4490
4491
+ let input ;
4492
+
4498
4493
if (
4499
4494
itemTypes . includes ( "number" ) ||
4500
4495
itemTypes . includes ( "integer" )
4501
4496
) {
4497
+ input = document . createElement ( "input" ) ;
4502
4498
input . type = "number" ;
4503
4499
input . step = itemTypes . includes ( "integer" )
4504
4500
? "1"
4505
4501
: "any" ;
4506
4502
} else if ( itemTypes . includes ( "boolean" ) ) {
4503
+ const hiddenFalse = document . createElement ( "input" ) ;
4504
+ hiddenFalse . type = "hidden" ;
4505
+ hiddenFalse . name = keyValidation . value + "[]" ;
4506
+ hiddenFalse . value = "false" ;
4507
+
4508
+ input = document . createElement ( "input" ) ;
4507
4509
input . type = "checkbox" ;
4510
+ input . name = keyValidation . value + "[]" ;
4508
4511
input . value = "true" ;
4509
- input . checked = value === true || value === "true" ;
4512
+
4513
+ const checked = value === true || value === "true" ;
4514
+ input . checked = checked ;
4515
+ hiddenFalse . disabled = checked ;
4516
+
4517
+ input . addEventListener ( "change" , ( ) => {
4518
+ hiddenFalse . disabled = input . checked ;
4519
+ } ) ;
4520
+
4521
+ wrapper . appendChild ( hiddenFalse ) ;
4522
+ wrapper . appendChild ( input ) ;
4510
4523
} else {
4524
+ input = document . createElement ( "input" ) ;
4511
4525
input . type = "text" ;
4512
4526
}
4513
4527
4528
+ input . name = input . name || keyValidation . value + "[]" ;
4529
+ input . required =
4530
+ schema . required && schema . required . includes ( key ) ;
4531
+ input . className =
4532
+ "mt-1 block w-full rounded-md border border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:bg-gray-900 text-gray-700 dark:text-gray-300 dark:border-gray-700 dark:focus:border-indigo-400 dark:focus:ring-indigo-400" ;
4533
+
4514
4534
if (
4515
4535
typeof value === "string" ||
4516
4536
typeof value === "number"
@@ -4528,7 +4548,11 @@ async function testTool(toolId) {
4528
4548
arrayContainer . removeChild ( wrapper ) ;
4529
4549
} ) ;
4530
4550
4531
- wrapper . appendChild ( input ) ;
4551
+ // only append if not boolean (boolean branch already appended input above)
4552
+ if ( ! itemTypes . includes ( "boolean" ) ) {
4553
+ wrapper . appendChild ( input ) ;
4554
+ }
4555
+
4532
4556
wrapper . appendChild ( delBtn ) ;
4533
4557
return wrapper ;
4534
4558
}
@@ -4560,44 +4584,66 @@ async function testTool(toolId) {
4560
4584
fieldDiv . appendChild ( arrayContainer ) ;
4561
4585
fieldDiv . appendChild ( addBtn ) ;
4562
4586
} else {
4563
- // Input field with validation (with multiline support)
4564
4587
let fieldInput ;
4565
- const isTextType = prop . type === "text" ;
4566
- if ( isTextType ) {
4567
- fieldInput = document . createElement ( "textarea" ) ;
4568
- fieldInput . rows = 4 ;
4569
- } else {
4588
+
4589
+ if ( prop . type === "boolean" ) {
4590
+ // Hidden "false" to ensure a value when unchecked
4591
+ const hiddenFalse = document . createElement ( "input" ) ;
4592
+ hiddenFalse . type = "hidden" ;
4593
+ hiddenFalse . name = keyValidation . value ;
4594
+ hiddenFalse . value = "false" ;
4595
+
4596
+ // Visible checkbox (submits "true" when checked)
4570
4597
fieldInput = document . createElement ( "input" ) ;
4571
- if ( prop . type === "number" || prop . type === "integer" ) {
4598
+ fieldInput . type = "checkbox" ;
4599
+ fieldInput . name = keyValidation . value ;
4600
+ fieldInput . value = "true" ;
4601
+
4602
+ fieldInput . required =
4603
+ schema . required && schema . required . includes ( key ) ;
4604
+ fieldInput . className =
4605
+ "mt-1 h-4 w-4 text-indigo-600 dark:text-indigo-200 border border-gray-300 rounded" ;
4606
+
4607
+ // set defaults
4608
+ const checked = prop . default === true ;
4609
+ fieldInput . checked = checked ;
4610
+ hiddenFalse . disabled = checked ;
4611
+
4612
+ fieldInput . addEventListener ( "change" , ( ) => {
4613
+ hiddenFalse . disabled = fieldInput . checked ;
4614
+ } ) ;
4615
+
4616
+ // append both (hidden first)
4617
+ fieldDiv . appendChild ( hiddenFalse ) ;
4618
+ fieldDiv . appendChild ( fieldInput ) ;
4619
+ } else {
4620
+ // Non-boolean handling
4621
+ if ( prop . type === "text" ) {
4622
+ fieldInput = document . createElement ( "textarea" ) ;
4623
+ fieldInput . rows = 4 ;
4624
+ } else if (
4625
+ prop . type === "number" ||
4626
+ prop . type === "integer"
4627
+ ) {
4628
+ fieldInput = document . createElement ( "input" ) ;
4572
4629
fieldInput . type = "number" ;
4573
- } else if ( prop . type === "boolean" ) {
4574
- fieldInput . type = "checkbox" ;
4575
4630
} else {
4576
4631
fieldInput = document . createElement ( "textarea" ) ;
4577
4632
fieldInput . rows = 1 ;
4578
4633
}
4579
- }
4580
4634
4581
- fieldInput . name = keyValidation . value ;
4582
- fieldInput . required =
4583
- schema . required && schema . required . includes ( key ) ;
4584
- fieldInput . className =
4585
- prop . type === "boolean"
4586
- ? "mt-1 h-4 w-4 text-indigo-600 dark:text-indigo-200 border border-gray-300 rounded"
4587
- : "mt-1 block w-full rounded-md border border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:bg-gray-900 text-gray-700 dark:text-gray-300 dark:border-gray-700 dark:focus:border-indigo-400 dark:focus:ring-indigo-400" ;
4588
-
4589
- // Set default values here
4590
- if ( prop . default !== undefined ) {
4591
- if ( fieldInput . type === "checkbox" ) {
4592
- fieldInput . checked = prop . default === true ;
4593
- } else if ( isTextType ) {
4594
- fieldInput . value = prop . default ;
4595
- } else {
4635
+ fieldInput . name = keyValidation . value ;
4636
+ fieldInput . required =
4637
+ schema . required && schema . required . includes ( key ) ;
4638
+ fieldInput . className =
4639
+ "mt-1 block w-full rounded-md border border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:bg-gray-900 text-gray-700 dark:text-gray-300 dark:border-gray-700 dark:focus:border-indigo-400 dark:focus:ring-indigo-400" ;
4640
+
4641
+ if ( prop . default !== undefined ) {
4596
4642
fieldInput . value = prop . default ;
4597
4643
}
4598
- }
4599
4644
4600
- fieldDiv . appendChild ( fieldInput ) ;
4645
+ fieldDiv . appendChild ( fieldInput ) ;
4646
+ }
4601
4647
}
4602
4648
4603
4649
container . appendChild ( fieldDiv ) ;
@@ -9156,4 +9202,4 @@ async function testA2AAgent(agentId, agentName, endpointUrl) {
9156
9202
}
9157
9203
9158
9204
// Expose A2A test function to global scope
9159
- window . testA2AAgent = testA2AAgent ;
9205
+ window . testA2AAgent = testA2AAgent ;
0 commit comments