| 565 | } |
| 566 | |
| 567 | func toolInfoBundle(response *ToolResponseRecord) outputBundle { |
| 568 | tool := response.Tool |
| 569 | return outputBundle{ |
| 570 | jsonValue: response, |
| 571 | human: func() (string, error) { |
| 572 | rows := []keyValue{ |
| 573 | {Label: toolOperatorToolIDValue, Value: tool.Descriptor.ToolID.String()}, |
| 574 | {Label: toolOperatorTitleValue, Value: stringOrDash(tool.Descriptor.DisplayTitle)}, |
| 575 | {Label: toolOperatorBackendValue, Value: string(tool.Descriptor.Backend.Kind)}, |
| 576 | {Label: toolOperatorSourceValue, Value: toolSourceSummary(tool.Descriptor.Source)}, |
| 577 | {Label: "Risk", Value: string(tool.Descriptor.Risk)}, |
| 578 | {Label: "Visibility", Value: string(tool.Descriptor.Visibility)}, |
| 579 | {Label: toolOperatorStatusValue, Value: toolAvailabilitySummary(tool.Availability)}, |
| 580 | {Label: "Callable", Value: formatBool(tool.Decision.Callable)}, |
| 581 | {Label: "Approval Required", Value: formatBool(tool.Decision.ApprovalRequired)}, |
| 582 | { |
| 583 | Label: "Reasons", |
| 584 | Value: stringOrDash(joinReasons(tool.Availability.ReasonCodes, tool.Decision.ReasonCodes)), |
| 585 | }, |
| 586 | {Label: "Input Schema", Value: stringOrDash(compactJSON(tool.Descriptor.InputSchema))}, |
| 587 | } |
| 588 | if output := compactJSON(tool.Descriptor.OutputSchema); output != "" { |
| 589 | rows = append(rows, keyValue{Label: "Output Schema", Value: output}) |
| 590 | } |
| 591 | return renderHumanSection("Tool", rows), nil |
| 592 | }, |
| 593 | toon: func() (string, error) { |
| 594 | return renderToonObject( |
| 595 | "tool", |
| 596 | []string{ |
| 597 | toolOperatorToolIDKey, |
| 598 | toolOperatorBackendKey, |
| 599 | automationSourceKey, |
| 600 | automationStatusKey, |
| 601 | "callable", |
| 602 | toolOperatorReasonsKey, |
| 603 | }, |
| 604 | []string{ |
| 605 | tool.Descriptor.ToolID.String(), |
| 606 | string(tool.Descriptor.Backend.Kind), |
| 607 | toolSourceSummary(tool.Descriptor.Source), |
| 608 | toolAvailabilitySummary(tool.Availability), |
| 609 | formatBool(tool.Decision.Callable), |
| 610 | joinReasons(tool.Availability.ReasonCodes, tool.Decision.ReasonCodes), |
| 611 | }, |
| 612 | ), nil |
| 613 | }, |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | func toolApprovalBundle(response ToolApprovalRecord) outputBundle { |
| 618 | return outputBundle{ |