Commit 3d250ed
Improve composite tool configuration ergonomics (#2589)
* Improve composite tool configuration ergonomics
Makes composite tool workflow configuration more user-friendly by
reducing verbosity and following "convention over configuration":
1. **Step type inference**: When 'tool' field is present, 'type' is
automatically inferred as "tool". Elicitation steps still require
explicit type for clarity.
2. **Optional timeout**: Timeout can be omitted and defaults to 30
minutes at runtime. Validator now allows 0 (use default) instead
of requiring explicit positive value.
Before:
```yaml
composite_tools:
- name: "fetch_data"
timeout: "30m" # Required even for default
steps:
- id: "fetch"
type: "tool" # Redundant when 'tool' field present
tool: "fetch_fetch"
```
After:
```yaml
composite_tools:
- name: "fetch_data"
# timeout omitted - uses 30m default
steps:
- id: "fetch"
tool: "fetch_fetch" # Type inferred as "tool"
```
Changes:
- Infer type="tool" when tool field is present
- Allow timeout=0 in validator (engine applies default)
- Handle empty timeout string in YAML loader
- Add comprehensive tests for both features
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* Move type inference and defaults to YAMLLoader
This refactoring addresses the architectural concern that validators should
be read-only and not mutate configuration values. The changes follow the
'convention over configuration' principle while maintaining clean separation
of concerns.
Changes:
- Move step type inference from validator to yaml_loader transformWorkflowStep()
- Update validator to be read-only (no longer mutates step.Type)
- Add validation to prevent ambiguous configurations (both tool and message fields)
- Add test case for the ambiguous scenario
- Update existing tests to reflect loader-based type inference
Benefits:
- Clear separation: Loader applies defaults, Validator validates invariants
- Follows existing patterns (elicitation timeout defaults in loader)
- Platform consistency (CLI and K8s produce same Config before validation)
- Validator becomes pure validation logic (no side effects)
Co-authored-by: Juan Antonio Osorio <[email protected]>
---------
Co-authored-by: Claude <[email protected]>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Juan Antonio Osorio <[email protected]>1 parent fbf7354 commit 3d250ed
File tree
3 files changed
+127
-6
lines changed- pkg/vmcp/config
3 files changed
+127
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
400 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
401 | 402 | | |
402 | 403 | | |
403 | 404 | | |
| |||
451 | 452 | | |
452 | 453 | | |
453 | 454 | | |
454 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
455 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
456 | 469 | | |
457 | 470 | | |
458 | 471 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
553 | 553 | | |
554 | 554 | | |
555 | 555 | | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
556 | 654 | | |
557 | 655 | | |
558 | 656 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
498 | | - | |
499 | | - | |
500 | | - | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
501 | 506 | | |
502 | 507 | | |
503 | 508 | | |
| |||
553 | 558 | | |
554 | 559 | | |
555 | 560 | | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
556 | 566 | | |
557 | 567 | | |
558 | 568 | | |
| |||
0 commit comments