MCPcopy
hub / github.com/FlowiseAI/Flowise / deleteTool

Function deleteTool

packages/ui/src/views/tools/ToolDialog.jsx:369–415  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

367 }
368
369 const deleteTool = async () => {
370 const confirmPayload = {
371 title: `Delete Tool`,
372 description: `Delete tool ${toolName}?`,
373 confirmButtonName: 'Delete',
374 cancelButtonName: 'Cancel'
375 }
376 const isConfirmed = await confirm(confirmPayload)
377
378 if (isConfirmed) {
379 try {
380 const delResp = await toolsApi.deleteTool(toolId)
381 if (delResp.data) {
382 enqueueSnackbar({
383 message: 'Tool deleted',
384 options: {
385 key: new Date().getTime() + Math.random(),
386 variant: 'success',
387 action: (key) => (
388 <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}>
389 <IconX />
390 </Button>
391 )
392 }
393 })
394 onConfirm()
395 }
396 } catch (error) {
397 enqueueSnackbar({
398 message: `Failed to delete Tool: ${
399 typeof error.response.data === 'object' ? error.response.data.message : error.response.data
400 }`,
401 options: {
402 key: new Date().getTime() + Math.random(),
403 variant: 'error',
404 persist: true,
405 action: (key) => (
406 <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}>
407 <IconX />
408 </Button>
409 )
410 }
411 })
412 onCancel()
413 }
414 }
415 }
416
417 const handlePastedJSON = (formattedData) => {
418 setToolSchema(formattedData)

Callers 1

ToolDialogFunction · 0.70

Calls 6

enqueueSnackbarFunction · 0.90
closeSnackbarFunction · 0.90
confirmFunction · 0.85
onCancelFunction · 0.85
onConfirmFunction · 0.70
getTimeMethod · 0.45

Tested by

no test coverage detected