AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { Permission } from '@activepieces/core-utils'
import { McpToolDefinition, ProjectScopedMcpServer } from '@activepieces/shared'
import { FastifyBaseLogger } from 'fastify'
import { z } from 'zod'
import { tableService } from '../../tables/table/table.service'
import { mcpUtils } from './mcp-utils'
const deleteTableInput = z.object({
tableId: z.string().describe('The ID of the table to delete. Use ap_list_tables to find it.'),
displayName: z.string().optional().describe('Short approval prompt shown to the user (e.g. "Delete Customer Emails table"). Must include what the action does and the target name.'),
})
export const apDeleteTableTool = (mcp: ProjectScopedMcpServer, log: FastifyBaseLogger): McpToolDefinition => {
return {
title: 'ap_delete_table',
permission: Permission.WRITE_TABLE,
description: 'Permanently delete a table and all its data.',
inputSchema: deleteTableInput.shape,
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
execute: async (args) => {
try {
const { tableId } = deleteTableInput.parse(args)
const table = await tableService.getOneOrThrow({
projectId: mcp.projectId,
id: tableId,
})
await tableService.delete({
projectId: mcp.projectId,
id: tableId,
})
return {
content: [{
type: 'text',
text: `✅ Table "${table.name}" deleted successfully.`,
}],
}
}
catch (err) {
log.error({ error: err, project: { id: mcp.projectId } }, 'ap_delete_table failed')
return mcpUtils.mcpToolError('Failed to delete table', err)
}
},
}
}