delete_matrix_rows
Remove specific data rows from the Knowledge Matrix in Google Sheets. Preview changes first, then confirm to delete rows 3 and above while preserving header rows.
Instructions
Delete rows from Knowledge Matrix with confirmation requirement. First call shows preview, second call with confirm=true executes deletion. Cannot delete header rows (1-2).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No | Set to true to actually delete (first call without this shows preview) | |
| endRow | Yes | Last row to delete (inclusive) | |
| startRow | Yes | First row to delete (must be >= 3) |
Implementation Reference
- index.js:715-717 (handler)Switch case handler that proxies the tool arguments to the remote Google Apps Script API endpoint 'deleteMatrixRows' via the generic callAPI function.case "delete_matrix_rows": result = await callAPI("deleteMatrixRows", args); break;
- index.js:477-498 (registration)Tool registration in the ListTools response, including name, description, and input schema definition.{ name: "delete_matrix_rows", description: "Delete rows from Knowledge Matrix with confirmation requirement. First call shows preview, second call with confirm=true executes deletion. Cannot delete header rows (1-2).", inputSchema: { type: "object", properties: { startRow: { type: "number", description: "First row to delete (must be >= 3)" }, endRow: { type: "number", description: "Last row to delete (inclusive)" }, confirm: { type: "boolean", description: "Set to true to actually delete (first call without this shows preview)" } }, required: ["startRow", "endRow"] } },
- index.js:480-496 (schema)Input schema defining parameters for the delete_matrix_rows tool: startRow, endRow (required), and optional confirm boolean.inputSchema: { type: "object", properties: { startRow: { type: "number", description: "First row to delete (must be >= 3)" }, endRow: { type: "number", description: "Last row to delete (inclusive)" }, confirm: { type: "boolean", description: "Set to true to actually delete (first call without this shows preview)" } }, required: ["startRow", "endRow"]
- index.js:74-131 (helper)Generic helper function used by all API-proxying tools (including delete_matrix_rows) to make HTTP POST requests to the Google Apps Script backend with action-specific endpoint and arguments.async function callAPI(action, data = {}) { debugLog('=== API CALL START ==='); debugLog(`Action: ${action}`); debugLog(`Data: ${JSON.stringify(data)}`); try { // Build form-encoded body for POST const formData = new URLSearchParams(); formData.append('action', action); // Add all data fields to form for (const [key, value] of Object.entries(data)) { if (value !== undefined && value !== null) { formData.append(key, value.toString()); } } const formString = formData.toString(); debugLog(`FormData: ${formString}`); debugLog(`API_URL: ${API_URL}`); // Use POST with proper content type const response = await fetch(API_URL, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: formString }); debugLog(`Response status: ${response.status}`); debugLog(`Response ok: ${response.ok}`); if (!response.ok) { debugLog(`Response not OK: ${response.status} ${response.statusText}`); throw new Error(`API request failed: ${response.status} ${response.statusText}`); } const text = await response.text(); debugLog(`Response text length: ${text.length}`); debugLog(`Response text: ${text}`); if (!text) { debugLog('ERROR: Empty response from API'); throw new Error('Empty response from API'); } const parsed = JSON.parse(text); debugLog(`Parsed successfully: ${JSON.stringify(parsed)}`); debugLog('=== API CALL END ==='); return parsed; } catch (error) { debugLog(`ERROR in callAPI: ${error.message}`); debugLog(`ERROR stack: ${error.stack}`); throw error; } }