kintone_delete_record
Delete a record from a Kintone app by providing app ID and record ID. Requires a confirmation flag to prevent accidental deletions.
Instructions
Delete a record from a Kintone app by ID with safety confirmation. ⚠️ Use 'kintone_list_apps' first to get available app IDs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | The ID of the Kintone app (use kintone_list_apps to see available app IDs) | |
| record_id | Yes | The ID of the record to delete | |
| revision | No | Record revision number for optimistic locking (optional but recommended) | |
| confirm | Yes | Confirmation flag to prevent accidental deletions (must be true) |
Implementation Reference
- The main handler function _handle_delete_record that executes the delete record logic. It validates arguments (app_id, record_id, confirm flag), calls client.delete_record(), and formats the response.
async def _handle_delete_record(arguments: Dict[str, Any], client: KintoneClient) -> List[types.TextContent]: """Handle kintone_delete_record tool call.""" app_id = arguments.get("app_id") record_id = arguments.get("record_id") revision = arguments.get("revision") confirm = arguments.get("confirm", False) if not app_id or not record_id: return [types.TextContent( type="text", text="Error: Both app_id and record_id are required" )] if not confirm: return [types.TextContent( type="text", text="Error: Deletion not confirmed. Set 'confirm' parameter to true to proceed with deletion." )] result = client.delete_record( app_id=app_id, record_id=record_id, revision=revision ) if result.get("success"): response_text = f"Successfully deleted record {record_id} from app {app_id}" if revision: response_text += f" (revision: {revision})" return [types.TextContent( type="text", text=response_text )] else: error_msg = result.get("error", "Unknown error occurred") return [types.TextContent( type="text", text=f"Error deleting record {record_id} from app {app_id}: {error_msg}" )] - The input schema definition for kintone_delete_record tool, specifying required parameters: app_id, record_id, and confirm (boolean safety flag), plus optional revision.
types.Tool( name="kintone_delete_record", description="Delete a record from a Kintone app by ID with safety confirmation. ⚠️ Use 'kintone_list_apps' first to get available app IDs.", inputSchema={ "type": "object", "properties": { "app_id": { "type": "string", "description": "The ID of the Kintone app (use kintone_list_apps to see available app IDs)" }, "record_id": { "type": "string", "description": "The ID of the record to delete" }, "revision": { "type": "integer", "description": "Record revision number for optimistic locking (optional but recommended)" }, "confirm": { "type": "boolean", "description": "Confirmation flag to prevent accidental deletions (must be true)", "default": False } }, "required": ["app_id", "record_id", "confirm"] } ) - src/mcp_kintone_lite/server.py:78-80 (registration)The server registration in handle_call_tool that routes kintone_delete_record to handle_crud_tools.
# CRUD tools elif name in ["kintone_create_record", "kintone_update_record", "kintone_delete_record"]: return await handle_crud_tools(name, arguments, client) - The KintoneClient.delete_record method that makes the actual DELETE request to the Kintone API (records.json endpoint) with app_id and record_id.
def delete_record(self, app_id: str, record_id: str, revision: Optional[int] = None) -> Dict[str, Any]: """Delete record by ID.""" data = { 'app': app_id, 'ids': [record_id] } if revision is not None: data['revisions'] = [revision] result = self._make_request('DELETE', 'records.json', data=data) if result['success']: return { "success": True, "deleted": True } return result - src/mcp_kintone_lite/server.py:59-66 (registration)The handle_list_tools function which registers the tool by calling get_crud_tools() that includes kintone_delete_record.
@server.list_tools() async def handle_list_tools() -> List[types.Tool]: """List available tools.""" tools = [] tools.extend(get_query_tools()) tools.extend(get_crud_tools()) tools.extend(get_metadata_tools()) return tools