MCPcopy Create free account
hub / github.com/compozy/agh / toolInfoBundle

Function toolInfoBundle

internal/cli/tool_operator.go:567–615  ·  view source on GitHub ↗
(response *ToolResponseRecord)

Source from the content-addressed store, hash-verified

565}
566
567func 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
617func toolApprovalBundle(response ToolApprovalRecord) outputBundle {
618 return outputBundle{

Callers 2

newToolInfoCommandFunction · 0.85

Calls 10

stringOrDashFunction · 0.85
toolSourceSummaryFunction · 0.85
toolAvailabilitySummaryFunction · 0.85
formatBoolFunction · 0.85
joinReasonsFunction · 0.85
appendFunction · 0.85
renderHumanSectionFunction · 0.85
renderToonObjectFunction · 0.85
compactJSONFunction · 0.70
StringMethod · 0.45

Tested by 1