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

Function updatePolicy

packages/plugins/toolkits/src/server.ts:402–427  ·  view source on GitHub ↗
(
    toolkitId: string,
    policyId: string,
    input: {
      readonly pattern?: string;
      readonly action?: ToolPolicyAction;
      readonly position?: string;
    },
  )

Source from the content-addressed store, hash-verified

400 });
401
402 const updatePolicy = (
403 toolkitId: string,
404 policyId: string,
405 input: {
406 readonly pattern?: string;
407 readonly action?: ToolPolicyAction;
408 readonly position?: string;
409 },
410 ) =>
411 Effect.gen(function* () {
412 if (input.pattern !== undefined) yield* validatePolicyPattern(input.pattern);
413 const toolkit = yield* requireToolkit(toolkitId);
414 const existing = yield* requirePolicy(toolkitId, policyId, toolkit.owner);
415 const entry = yield* storage.policies.put({
416 owner: toolkit.owner,
417 key: policyId,
418 data: {
419 ...existing.data,
420 ...(input.pattern !== undefined ? { pattern: input.pattern } : {}),
421 ...(input.action !== undefined ? { action: input.action } : {}),
422 ...(input.position !== undefined ? { position: input.position } : {}),
423 updatedAt: Date.now(),
424 },
425 });
426 return policyToResponse(entry.data);
427 });
428
429 const removePolicy = (toolkitId: string, policyId: string) =>
430 Effect.gen(function* () {

Callers

nothing calls this directly

Calls 5

validatePolicyPatternFunction · 0.85
requireToolkitFunction · 0.85
requirePolicyFunction · 0.85
policyToResponseFunction · 0.70
putMethod · 0.65

Tested by

no test coverage detected