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

Function toolAnnotationsView

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

Source from the content-addressed store, hash-verified

1234// fields are picked explicitly rather than spread: a caller reading the view
1235// gets the contract in `tool.ts` and nothing a plugin keeps for itself.
1236const toolAnnotationsView = (
1237 annotations: ToolAnnotations | undefined,
1238): ToolAnnotationsView | undefined => {
1239 if (!annotations) return undefined;
1240 const view: {
1241 requiresApproval?: boolean;
1242 approvalDescription?: string;
1243 mayElicit?: boolean;
1244 } = {};
1245 if (typeof annotations.requiresApproval === "boolean") {
1246 view.requiresApproval = annotations.requiresApproval;
1247 }
1248 if (typeof annotations.approvalDescription === "string") {
1249 view.approvalDescription = annotations.approvalDescription;
1250 }
1251 if (typeof annotations.mayElicit === "boolean") view.mayElicit = annotations.mayElicit;
1252 return Object.keys(view).length > 0 ? ToolAnnotationsView.make(view) : undefined;
1253};
1254
1255// ---------------------------------------------------------------------------
1256// Condition builders

Callers 1

toolSchemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected