get_matrix_row
Retrieve complete revenue tracking data for a specific date from the business management matrix. Enter date in YYYY-MM-DD format to access all topics and metrics for that day.
Instructions
Get all topics for a specific date. Returns complete row from Matrix.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | Date in YYYY-MM-DD format (defaults to today) |
Implementation Reference
- index.js:441-453 (registration)Registration of the 'get_matrix_row' tool, including its description and input schema definition.{ name: "get_matrix_row", description: "Get all topics for a specific date. Returns complete row from Matrix.", inputSchema: { type: "object", properties: { date: { type: "string", description: "Date in YYYY-MM-DD format (defaults to today)" } } } },
- index.js:707-709 (handler)Handler implementation for the 'get_matrix_row' tool. Delegates execution to the remote Google Apps Script API via the callAPI helper function with action 'getMatrixRow'.case "get_matrix_row": result = await callAPI("getMatrixRow", args); break;
- index.js:444-452 (schema)Input schema validation for the 'get_matrix_row' tool, defining the expected 'date' parameter.inputSchema: { type: "object", properties: { date: { type: "string", description: "Date in YYYY-MM-DD format (defaults to today)" } } }
- index.js:74-131 (helper)Helper function callAPI used by all remote tools including get_matrix_row to make HTTP POST requests to the Google Apps Script web app endpoint.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; } }