maasy_get_crm_summary
Retrieve a CRM pipeline summary: get leads by status, hot leads, contacts, opportunities, and total pipeline value for a brand. Requires brand UUID.
Instructions
CRM pipeline: leads by status, hot leads, contacts, opportunities, total pipeline value.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Brand UUID |
Implementation Reference
- src/index.ts:224-229 (registration)Registration of the 'maasy_get_crm_summary' tool via server.tool() with schema and handler binding to 'get_crm_summary'.
server.tool( "maasy_get_crm_summary", "CRM pipeline: leads by status, hot leads, contacts, opportunities, total pipeline value.", { project_id: z.string().optional().describe("Brand UUID") }, toolHandler("get_crm_summary") ); - src/index.ts:225-228 (schema)Input schema: project_id (optional string, describes Brand UUID). No output schema defined beyond generic JSON response.
"maasy_get_crm_summary", "CRM pipeline: leads by status, hot leads, contacts, opportunities, total pipeline value.", { project_id: z.string().optional().describe("Brand UUID") }, toolHandler("get_crm_summary") - src/index.ts:26-43 (handler)The toolHandler() factory function that wraps all tool calls. For 'maasy_get_crm_summary', it calls callGateway('get_crm_summary', args) which delegates to the remote mcp-gateway edge function.
function toolHandler(toolName: string, argsFn?: (args: Record<string, unknown>) => Record<string, unknown>) { return async (args: Record<string, unknown>) => { try { const gatewayArgs = argsFn ? argsFn(args) : args; // Auto-inject default project_id if not provided if (DEFAULT_PROJECT_ID && !gatewayArgs.project_id) { gatewayArgs.project_id = DEFAULT_PROJECT_ID; } const result = await callGateway(toolName, gatewayArgs); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] }; } catch (e: unknown) { return { content: [{ type: "text" as const, text: `Error: ${e instanceof Error ? e.message : String(e)}` }], isError: true, }; } }; } - src/supabase.ts:42-58 (helper)The callGateway() function sends the tool name ('get_crm_summary') and args to the Supabase edge function 'mcp-gateway' via POST, which is where the actual CRM summary logic executes.
export async function callGateway(tool: string, args: Record<string, unknown> = {}): Promise<unknown> { const res = await fetch(gatewayUrl, { method: "POST", headers: { "Content-Type": "application/json", [authHeader.name]: authHeader.value, }, body: JSON.stringify({ tool, args }), }); const data = await res.json(); if (!res.ok) { throw new Error(data.error || `Gateway error (${res.status})`); } return data.result;