Skip to main content
Glama

add_revenue

Record closed deals and revenue data in Google Sheets for tracking sales performance and financial metrics.

Instructions

Add a closed deal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientNameYes
leadIdNo
serviceTypeNo
projectDescriptionNo
contractValueYes
statusNo
paymentReceivedNo
notesNo

Implementation Reference

  • Handler for the 'add_revenue' MCP tool. Dispatches the tool call to the backend Google Apps Script API via callAPI with action 'addRevenue' and the provided arguments.
    case "add_revenue":
      result = await callAPI("addRevenue", args);
      break;
  • index.js:240-263 (registration)
    Registration of the 'add_revenue' tool in the MCP server's tool list, including name, description, and input schema definition.
    {
      name: "add_revenue",
      description: "Add a closed deal",
      inputSchema: {
        type: "object",
        properties: {
          clientName: { type: "string" },
          leadId: { type: "number" },
          serviceType: {
            type: "string",
            enum: ["Website", "Automation", "SaaS Consulting", "Combined", "Other"]
          },
          projectDescription: { type: "string" },
          contractValue: { type: "number" },
          status: {
            type: "string",
            enum: ["Proposed", "Accepted", "In Progress", "Delivered", "Paid"]
          },
          paymentReceived: { type: "number" },
          notes: { type: "string" },
        },
        required: ["clientName", "contractValue"],
      },
    },
  • Input schema validation definition for the 'add_revenue' tool.
    inputSchema: {
      type: "object",
      properties: {
        clientName: { type: "string" },
        leadId: { type: "number" },
        serviceType: {
          type: "string",
          enum: ["Website", "Automation", "SaaS Consulting", "Combined", "Other"]
        },
        projectDescription: { type: "string" },
        contractValue: { type: "number" },
        status: {
          type: "string",
          enum: ["Proposed", "Accepted", "In Progress", "Delivered", "Paid"]
        },
        paymentReceived: { type: "number" },
        notes: { type: "string" },
      },
      required: ["clientName", "contractValue"],
    },
  • Helper function callAPI that handles all backend API calls for MCP tools, including 'addRevenue'. Makes POST requests to the Google Apps Script web app URL with action and form-encoded data.
    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?

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Add a closed deal' implies a write operation that creates a new record, but it doesn't specify permissions needed, whether it's idempotent, what happens on duplicate entries, or the response format. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, clearly stating the core action without unnecessary elaboration. Every word earns its place, making it easy to parse quickly.

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?

Given the complexity (8 parameters, mutation operation) and lack of annotations or output schema, the description is incomplete. It doesn't explain the tool's behavior, parameter meanings, or what to expect upon execution. For a tool that likely modifies data and has multiple inputs, more context is needed to use it effectively.

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

Parameters2/5

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

The description adds no parameter semantics beyond what the input schema provides. With 8 parameters and 0% schema description coverage, the schema only defines types and enums without explanations. The description doesn't clarify what 'clientName', 'contractValue', or other fields mean in context, leaving parameters largely undocumented.

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 'Add a closed deal' clearly states the verb ('Add') and resource ('closed deal'), making the purpose understandable. It distinguishes from siblings like 'add_lead' or 'add_task' by specifying the type of record being added. However, it doesn't explicitly mention revenue or financial aspects that the tool name suggests, which could be slightly more specific.

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. With siblings like 'add_lead', 'update_lead', and 'log_daily_metrics', there's no indication of prerequisites (e.g., whether a lead must exist first) or context for choosing this over similar tools. It merely states what it does without usage context.

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