MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / toolAnnotationsView

Function toolAnnotationsView

packages/core/sdk/src/executor.ts:1222–1239  ·  view source on GitHub ↗
(
  annotations: ToolAnnotations | undefined,
)

Source from the content-addressed store, hash-verified

1220// fields are picked explicitly rather than spread: a caller reading the view
1221// gets the contract in `tool.ts` and nothing a plugin keeps for itself.
1222const toolAnnotationsView = (
1223 annotations: ToolAnnotations | undefined,
1224): ToolAnnotationsView | undefined => {
1225 if (!annotations) return undefined;
1226 const view: {
1227 requiresApproval?: boolean;
1228 approvalDescription?: string;
1229 mayElicit?: boolean;
1230 } = {};
1231 if (typeof annotations.requiresApproval === "boolean") {
1232 view.requiresApproval = annotations.requiresApproval;
1233 }
1234 if (typeof annotations.approvalDescription === "string") {
1235 view.approvalDescription = annotations.approvalDescription;
1236 }
1237 if (typeof annotations.mayElicit === "boolean") view.mayElicit = annotations.mayElicit;
1238 return Object.keys(view).length > 0 ? ToolAnnotationsView.make(view) : undefined;
1239};
1240
1241// ---------------------------------------------------------------------------
1242// Condition builders

Callers 1

toolSchemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected