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

Function CreateToolkitDialog

packages/plugins/toolkits/src/page.tsx:520–592  ·  view source on GitHub ↗
(props: {
  owner: Owner;
  showOwnerLabels: boolean;
  open: boolean;
  onOpenChange: (open: boolean) => void;
  onCreate: (input: { owner: Owner; name: string }) => Promise<void>;
})

Source from the content-addressed store, hash-verified

518 : "New toolkit";
519
520function CreateToolkitDialog(props: {
521 owner: Owner;
522 showOwnerLabels: boolean;
523 open: boolean;
524 onOpenChange: (open: boolean) => void;
525 onCreate: (input: { owner: Owner; name: string }) => Promise<void>;
526}) {
527 const inputId = useId();
528 const [name, setName] = useState("");
529 const trimmed = name.trim();
530 const title = addToolkitTitle(props.owner, props.showOwnerLabels);
531
532 const submit = async () => {
533 if (!trimmed) return;
534 await props.onCreate({ owner: props.owner, name: trimmed });
535 setName("");
536 props.onOpenChange(false);
537 };
538
539 return (
540 <Dialog
541 open={props.open}
542 onOpenChange={(nextOpen) => {
543 props.onOpenChange(nextOpen);
544 if (!nextOpen) setName("");
545 }}
546 >
547 <DialogContent
548 className="flex flex-col gap-0 overflow-hidden rounded-md border-border/80 bg-card p-0 shadow-2xl"
549 style={{ width: "min(24rem, calc(100vw - 2rem))" }}
550 >
551 <form
552 className="grid"
553 onSubmit={(event) => {
554 event.preventDefault();
555 void submit();
556 }}
557 >
558 <DialogHeader className="px-4 pb-1 pt-4">
559 <DialogTitle className="text-sm">{title}</DialogTitle>
560 <DialogDescription className="text-xs">
561 Group tools and expose them at a dedicated MCP URL.
562 </DialogDescription>
563 </DialogHeader>
564 <div className="grid gap-1.5 px-4 py-3">
565 <Label htmlFor={inputId} className="text-xs text-muted-foreground">
566 Toolkit name
567 </Label>
568 <Input
569 id={inputId}
570 value={name}
571 onChange={(event) => setName(event.target.value)}
572 placeholder="e.g. Support tools"
573 autoFocus
574 className="h-9"
575 />
576 </div>
577 <DialogFooter className="px-4 pb-4 pt-1">

Callers

nothing calls this directly

Calls 2

addToolkitTitleFunction · 0.85
submitFunction · 0.70

Tested by

no test coverage detected