setup_matrix_sheet
Create a structured Knowledge Matrix sheet with proper headers to organize revenue tracking data before using other Matrix tools in the Revenue Engine MCP system.
Instructions
Auto-create Knowledge Matrix sheet with proper structure and headers. Run this once before using other Matrix tools.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:695-697 (handler)Handler for the 'setup_matrix_sheet' tool. Delegates execution to the Google Apps Script web app by calling callAPI('setupMatrixSheet').case "setup_matrix_sheet": result = await callAPI("setupMatrixSheet"); break;
- index.js:389-395 (registration)Registration of the 'setup_matrix_sheet' tool in the MCP server's tool list, including description and input schema (no parameters required).name: "setup_matrix_sheet", description: "Auto-create Knowledge Matrix sheet with proper structure and headers. Run this once before using other Matrix tools.", inputSchema: { type: "object", properties: {} } },
- index.js:391-395 (schema)Input schema for 'setup_matrix_sheet' tool: empty object (no input parameters).inputSchema: { type: "object", properties: {} } },
- index.js:74-131 (helper)Shared helper function callAPI used by the handler to proxy requests to the Google Apps Script backend at API_URL, which implements the actual 'setupMatrixSheet' logic.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; } }