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

Function create

packages/plugins/toolkits/src/server.ts:305–323  ·  view source on GitHub ↗
(input: {
    readonly owner: Owner;
    readonly name: string;
    readonly slug?: string;
  })

Source from the content-addressed store, hash-verified

303 );
304
305 const create = (input: {
306 readonly owner: Owner;
307 readonly name: string;
308 readonly slug?: string;
309 }) =>
310 Effect.gen(function* () {
311 const name = input.name.trim();
312 if (!name) return yield* fail("Toolkit name is required.");
313 const slug = yield* normalizeSlugEffect({ name, slug: input.slug });
314 yield* assertSlugAvailable(slug);
315 const now = Date.now();
316 const id = newId("tk");
317 const entry = yield* storage.toolkits.put({
318 owner: input.owner,
319 key: id,
320 data: { id, slug, name, createdAt: now, updatedAt: now },
321 });
322 return toolkitToResponse(entry);
323 });
324
325 const update = (toolkitId: string, input: { readonly name?: string; readonly slug?: string }) =>
326 Effect.gen(function* () {

Callers

nothing calls this directly

Calls 6

normalizeSlugEffectFunction · 0.85
assertSlugAvailableFunction · 0.85
newIdFunction · 0.85
toolkitToResponseFunction · 0.85
failFunction · 0.70
putMethod · 0.65

Tested by

no test coverage detected