log_daily_metrics
Record daily sales performance metrics including outreach attempts, responses, calls booked, proposals sent, deals closed, and revenue generated for revenue tracking and analysis.
Instructions
Log daily activity metrics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| callsBooked | No | ||
| date | No | YYYY-MM-DD | |
| dealsClosed | No | ||
| outreachAttempts | No | ||
| proposalsSent | No | ||
| responses | No | ||
| revenueClosed | No |
Implementation Reference
- index.js:670-672 (handler)Handler implementation for the 'log_daily_metrics' tool. Forwards the tool arguments to an external API endpoint via the callAPI helper function with action 'logMetric'.case "log_daily_metrics": result = await callAPI("logMetric", args); break;
- index.js:310-325 (registration)Registration of the 'log_daily_metrics' tool in the ListTools response, including name, description, and input schema definition.{ name: "log_daily_metrics", description: "Log daily activity metrics", inputSchema: { type: "object", properties: { date: { type: "string", description: "YYYY-MM-DD" }, outreachAttempts: { type: "number" }, responses: { type: "number" }, callsBooked: { type: "number" }, proposalsSent: { type: "number" }, dealsClosed: { type: "number" }, revenueClosed: { type: "number" }, }, }, },
- index.js:313-323 (schema)Input schema definition for the 'log_daily_metrics' tool, specifying parameters for logging daily metrics.inputSchema: { type: "object", properties: { date: { type: "string", description: "YYYY-MM-DD" }, outreachAttempts: { type: "number" }, responses: { type: "number" }, callsBooked: { type: "number" }, proposalsSent: { type: "number" }, dealsClosed: { type: "number" }, revenueClosed: { type: "number" }, },
- index.js:74-131 (helper)Shared helper function callAPI used by the handler to make HTTP POST requests to the external Google Apps Script API 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; } }