apipost_delete
Remove API documentation entries from ApiPost by specifying interface IDs. Use this tool to delete single or multiple API interfaces after retrieving their IDs from the interface list.
Instructions
批量删除API接口文档,支持单个或多个接口删除。删除前先用apipost_list查看接口列表获取ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_ids | Yes | API接口ID数组(可从列表中获取target_id)- 支持单个["id1"]或多个["id1","id2","id3"] |
Implementation Reference
- src/index.ts:957-971 (registration)Registration of the 'apipost_delete' tool in the MCP server tools list, including its name, description, and input schema.{ name: 'apipost_delete', description: '批量删除API接口文档,支持单个或多个接口删除。删除前先用apipost_list查看接口列表获取ID', inputSchema: { type: 'object', properties: { api_ids: { type: 'array', items: { type: 'string' }, description: 'API接口ID数组(可从列表中获取target_id)- 支持单个["id1"]或多个["id1","id2","id3"]' } }, required: ['api_ids'] } }
- src/index.ts:1734-1757 (handler)Handler implementation for 'apipost_delete' tool. Performs security check, validates input api_ids array, sends POST request to ApiPost's /open/apis/delete endpoint with project_id and target_ids, handles response, and returns confirmation message listing deleted IDs.case 'apipost_delete': if (!checkSecurityPermission('delete')) { throw new Error(`🔒 安全模式 "${APIPOST_SECURITY_MODE}" 不允许删除操作。需要 "full" 模式。`); } const apiIds = args.api_ids; if (!apiIds || !Array.isArray(apiIds) || apiIds.length === 0) { throw new Error('请提供要删除的API接口ID数组'); } const deleteData = { project_id: currentWorkspace.projectId, target_ids: apiIds }; const deleteResult = await apiClient.post('/open/apis/delete', deleteData); if (deleteResult.data.code !== 0) { throw new Error(`删除失败: ${deleteResult.data.msg}`); } let deleteText = `批量删除完成!\n删除数量: ${apiIds.length} 个接口\n删除的ID:\n`; apiIds.forEach((id, index) => { deleteText += `${index + 1}. ${id}\n`; }); return { content: [{ type: 'text', text: deleteText }] };
- src/index.ts:960-970 (schema)Input schema definition for the 'apipost_delete' tool, specifying an object with required 'api_ids' array of strings.inputSchema: { type: 'object', properties: { api_ids: { type: 'array', items: { type: 'string' }, description: 'API接口ID数组(可从列表中获取target_id)- 支持单个["id1"]或多个["id1","id2","id3"]' } }, required: ['api_ids'] }