Skip to main content
Glama

update_lead

Modify lead details like status, value, notes, and next actions in the revenue pipeline to maintain accurate sales tracking and follow-up scheduling.

Instructions

Update an existing lead

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
leadIdYesLead ID to update
statusNo
estimatedValueNo
notesNo
nextActionNo
nextActionDateNoYYYY-MM-DD

Implementation Reference

  • Handler for the 'update_lead' tool that delegates the execution to the external Google Apps Script API via callAPI('updateLead', args).
    case "update_lead":
      result = await callAPI("updateLead", args);
      break;
  • Input schema defining the parameters for the 'update_lead' tool, including leadId (required), status, estimatedValue, notes, nextAction, and nextActionDate.
    inputSchema: {
      type: "object",
      properties: {
        leadId: { type: "number", description: "Lead ID to update" },
        status: {
          type: "string",
          enum: ["New", "Contacted", "Call Booked", "Proposal Sent", "Closed", "Lost"]
        },
        estimatedValue: { type: "number" },
        notes: { type: "string" },
        nextAction: { type: "string" },
        nextActionDate: { type: "string", description: "YYYY-MM-DD" },
      },
      required: ["leadId"],
    },
  • index.js:197-215 (registration)
    Registration of the 'update_lead' tool in the MCP server's listTools response, specifying name, description, and input schema.
    {
      name: "update_lead",
      description: "Update an existing lead",
      inputSchema: {
        type: "object",
        properties: {
          leadId: { type: "number", description: "Lead ID to update" },
          status: {
            type: "string",
            enum: ["New", "Contacted", "Call Booked", "Proposal Sent", "Closed", "Lost"]
          },
          estimatedValue: { type: "number" },
          notes: { type: "string" },
          nextAction: { type: "string" },
          nextActionDate: { type: "string", description: "YYYY-MM-DD" },
        },
        required: ["leadId"],
      },
    },
  • Shared helper function callAPI that all tools use to POST requests to the Google Apps Script backend at the specified API_URL, handling form data, logging, and JSON parsing.
    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;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. 'Update an existing lead' implies a mutation operation but doesn't specify permissions required, whether changes are reversible, error handling, or response format. For a mutation tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is maximally concise - a single four-word phrase that communicates the core purpose without any wasted words. It's appropriately sized for a straightforward update operation and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 6 parameters, 33% schema coverage, no annotations, and no output schema, the description is inadequate. It doesn't explain what constitutes a successful update, what data is returned, error conditions, or business logic around status transitions. The agent lacks sufficient context to use this tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is only 33% (2 of 6 parameters have descriptions). The description adds no parameter information beyond what's implied by 'update' - it doesn't explain what fields can be updated, their purposes, or constraints. With low schema coverage, the description fails to compensate for undocumented parameters like 'estimatedValue', 'notes', 'nextAction'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and resource ('an existing lead'), making the purpose immediately understandable. It distinguishes from sibling 'add_lead' by specifying 'existing' rather than new creation. However, it doesn't specify what aspects can be updated or differentiate from other update tools like 'update_task'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites like needing a valid lead ID, nor does it contrast with similar operations like 'add_lead' for new leads or 'update_task' for different resources. The agent must infer usage from context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/PromptishOperations/mcpSpec'

If you have feedback or need assistance with the MCP directory API, please join our Discord server