get_pipeline
Retrieve all active leads currently in the sales pipeline for comprehensive revenue tracking and business management.
Instructions
Get all leads in the pipeline
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:158-165 (registration)Registration of the 'get_pipeline' tool in the ListToolsRequestSchema handler, including name, description, and empty input schema.{ name: "get_pipeline", description: "Get all leads in the pipeline", inputSchema: { type: "object", properties: {}, }, },
- index.js:630-632 (handler)Handler logic for the 'get_pipeline' tool within the CallToolRequestSchema switch statement. Delegates execution to the shared callAPI helper with action 'getPipeline'.case "get_pipeline": result = await callAPI("getPipeline"); break;
- index.js:74-131 (helper)Shared helper function callAPI that performs HTTP POST requests to the Google Apps Script backend (API_URL), used by get_pipeline with action='getPipeline'. Handles form-encoding, logging, error handling, and JSON parsing of responses.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; } }