Skip to main content
Glama

create_lead

Create a new lead record with details like title, contact info, status, and associated account or user.

Instructions

Create a lead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleNoTitle of the lead
account_idNoID of the account linked to this lead
user_idNoID of the user linked to this lead
valueNoDecimal representing the price of a lead
company_nameNoName of the company where this lead comes from
first_nameNoThe first name of the lead
middle_nameNoThe middle name of the lead
last_nameNoThe last name of the lead
administrator_idNoID of administrator that owns the lead
emailNoThe email of the lead
phoneNoThe phone number of the lead **Note** : Use an international phone format unless the phone number is from the educator configured country.
statusNoThe status of the lead
qualityNoStar scoring for the lead
wants_newsletterNoIndicates if lead wants to receive the newsletter or not
commentNoComment for a lead
label_idsNoIDs of the labels
address_attributesNo
lead_productsNoArray of products and variants the lead is interested in.

Implementation Reference

  • The handler function that executes the 'create_lead' tool logic. It POSTs to /leads with the input body, logs the response, and formats the created record.
    async (body) => {
      try {
        const record = await apiPost<EduframeRecord>("/leads", body);
        void logResponse("create_lead", body, record);
        return formatCreate(record, "lead");
      } catch (error) {
        return formatError(error);
      }
    },
  • The input schema definition for 'create_lead'. Defines all optional fields: title, account_id, user_id, value, company_name, first_name, middle_name, last_name, administrator_id, email, phone, status, quality, wants_newsletter, comment, label_ids, address_attributes, and lead_products.
    {
      description: "Create a lead.",
      annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
      inputSchema: {
        title: z.string().optional().describe("Title of the lead"),
        account_id: z.number().int().optional().describe("ID of the account linked to this lead"),
        user_id: z.number().int().optional().describe("ID of the user linked to this lead"),
        value: z.string().optional().describe("Decimal representing the price of a lead"),
        company_name: z.string().optional().describe("Name of the company where this lead comes from"),
        first_name: z.string().optional().describe("The first name of the lead"),
        middle_name: z.string().optional().describe("The middle name of the lead"),
        last_name: z.string().optional().describe("The last name of the lead"),
        administrator_id: z.number().int().optional().describe("ID of administrator that owns the lead"),
        email: z.string().optional().describe("The email of the lead"),
        phone: z
          .string()
          .optional()
          .describe(
            "The phone number of the lead\n**Note** : Use an international phone format unless the phone number is\nfrom the educator configured country.\n",
          ),
        status: leadStatusEnum.optional().describe("The status of the lead"),
        quality: z.number().optional().describe("Star scoring for the lead"),
        wants_newsletter: z.boolean().optional().describe("Indicates if lead wants to receive the newsletter or not"),
        comment: z.string().optional().describe("Comment for a lead"),
        label_ids: z.array(z.number().int()).optional().describe("IDs of the labels"),
        address_attributes: z
          .object({
            addressee: z.string().optional().describe("The addressee of the address."),
            address: z.string().describe("Concatenation of the street and house number."),
            address_line2: z.string().optional().describe("A string representing the second line of the address."),
            postal_code: z.string().describe("A string representing the postal code."),
            city: z.string().describe("A string representing the city."),
            state_province: z.string().optional().describe("An letter USA state code."),
            country: z.string().describe("An ISO3166 two-letter country code."),
          })
          .optional(),
        lead_products: z
          .array(
            z.object({
              catalog_product_id: z.number().int().describe("ID of the catalog product"),
              catalog_variant_id: z.number().int().optional().describe("ID of the catalog variant"),
            }),
          )
          .optional()
          .describe("Array of products and variants the lead is interested in.\n"),
      },
  • Registration of the 'create_lead' tool on the MCP server via server.registerTool(). Includes description and annotations.
    server.registerTool(
      "create_lead",
      {
        description: "Create a lead.",
        annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
        inputSchema: {
          title: z.string().optional().describe("Title of the lead"),
          account_id: z.number().int().optional().describe("ID of the account linked to this lead"),
          user_id: z.number().int().optional().describe("ID of the user linked to this lead"),
          value: z.string().optional().describe("Decimal representing the price of a lead"),
          company_name: z.string().optional().describe("Name of the company where this lead comes from"),
          first_name: z.string().optional().describe("The first name of the lead"),
          middle_name: z.string().optional().describe("The middle name of the lead"),
          last_name: z.string().optional().describe("The last name of the lead"),
          administrator_id: z.number().int().optional().describe("ID of administrator that owns the lead"),
          email: z.string().optional().describe("The email of the lead"),
          phone: z
            .string()
            .optional()
            .describe(
              "The phone number of the lead\n**Note** : Use an international phone format unless the phone number is\nfrom the educator configured country.\n",
            ),
          status: leadStatusEnum.optional().describe("The status of the lead"),
          quality: z.number().optional().describe("Star scoring for the lead"),
          wants_newsletter: z.boolean().optional().describe("Indicates if lead wants to receive the newsletter or not"),
          comment: z.string().optional().describe("Comment for a lead"),
          label_ids: z.array(z.number().int()).optional().describe("IDs of the labels"),
          address_attributes: z
            .object({
              addressee: z.string().optional().describe("The addressee of the address."),
              address: z.string().describe("Concatenation of the street and house number."),
              address_line2: z.string().optional().describe("A string representing the second line of the address."),
              postal_code: z.string().describe("A string representing the postal code."),
              city: z.string().describe("A string representing the city."),
              state_province: z.string().optional().describe("An letter USA state code."),
              country: z.string().describe("An ISO3166 two-letter country code."),
            })
            .optional(),
          lead_products: z
            .array(
              z.object({
                catalog_product_id: z.number().int().describe("ID of the catalog product"),
                catalog_variant_id: z.number().int().optional().describe("ID of the catalog variant"),
              }),
            )
            .optional()
            .describe("Array of products and variants the lead is interested in.\n"),
        },
      },
      async (body) => {
        try {
          const record = await apiPost<EduframeRecord>("/leads", body);
          void logResponse("create_lead", body, record);
          return formatCreate(record, "lead");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • The export function registerLeadTools() that wraps the registration of all lead-related tools including create_lead.
    export function registerLeadTools(server: McpServer): void {
      server.registerTool(
        "get_leads",
        {
          description: "Get all lead records",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            cursor: z.string().optional().describe("Cursor for fetching the next page of results"),
            per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"),
            email: z.string().optional().describe("Filter leads by exact email match"),
          },
        },
        async ({ cursor, per_page, email }) => {
          try {
            const result = await apiList<EduframeRecord>("/leads", { cursor, per_page, email });
            void logResponse("get_leads", { cursor, per_page, email }, result);
            const toolResult = formatList(result.records, "leads");
            if (result.nextCursor) {
              toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
            }
            return toolResult;
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "get_lead",
        {
          description: "Get one lead record",
          annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
          inputSchema: { id: z.number().int().positive().describe("ID of the lead to retrieve") },
        },
        async ({ id }) => {
          try {
            const record = await apiGet<EduframeRecord>(`/leads/${id}`);
            void logResponse("get_lead", { id }, record);
            return formatShow(record, "lead");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "create_lead",
        {
          description: "Create a lead.",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },
          inputSchema: {
            title: z.string().optional().describe("Title of the lead"),
            account_id: z.number().int().optional().describe("ID of the account linked to this lead"),
            user_id: z.number().int().optional().describe("ID of the user linked to this lead"),
            value: z.string().optional().describe("Decimal representing the price of a lead"),
            company_name: z.string().optional().describe("Name of the company where this lead comes from"),
            first_name: z.string().optional().describe("The first name of the lead"),
            middle_name: z.string().optional().describe("The middle name of the lead"),
            last_name: z.string().optional().describe("The last name of the lead"),
            administrator_id: z.number().int().optional().describe("ID of administrator that owns the lead"),
            email: z.string().optional().describe("The email of the lead"),
            phone: z
              .string()
              .optional()
              .describe(
                "The phone number of the lead\n**Note** : Use an international phone format unless the phone number is\nfrom the educator configured country.\n",
              ),
            status: leadStatusEnum.optional().describe("The status of the lead"),
            quality: z.number().optional().describe("Star scoring for the lead"),
            wants_newsletter: z.boolean().optional().describe("Indicates if lead wants to receive the newsletter or not"),
            comment: z.string().optional().describe("Comment for a lead"),
            label_ids: z.array(z.number().int()).optional().describe("IDs of the labels"),
            address_attributes: z
              .object({
                addressee: z.string().optional().describe("The addressee of the address."),
                address: z.string().describe("Concatenation of the street and house number."),
                address_line2: z.string().optional().describe("A string representing the second line of the address."),
                postal_code: z.string().describe("A string representing the postal code."),
                city: z.string().describe("A string representing the city."),
                state_province: z.string().optional().describe("An letter USA state code."),
                country: z.string().describe("An ISO3166 two-letter country code."),
              })
              .optional(),
            lead_products: z
              .array(
                z.object({
                  catalog_product_id: z.number().int().describe("ID of the catalog product"),
                  catalog_variant_id: z.number().int().optional().describe("ID of the catalog variant"),
                }),
              )
              .optional()
              .describe("Array of products and variants the lead is interested in.\n"),
          },
        },
        async (body) => {
          try {
            const record = await apiPost<EduframeRecord>("/leads", body);
            void logResponse("create_lead", body, record);
            return formatCreate(record, "lead");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "update_lead",
        {
          description: "Update a lead",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            id: z.number().int().positive().describe("ID of the lead to update"),
            status: leadStatusEnum.describe("The status of the lead"),
          },
        },
        async ({ id, ...body }) => {
          try {
            const record = await apiPatch<EduframeRecord>(`/leads/${id}`, body);
            void logResponse("update_lead", { id, ...body }, record);
            return formatUpdate(record, "lead");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    
      server.registerTool(
        "delete_lead",
        {
          description: "Delete a lead.",
          annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true },
          inputSchema: { id: z.number().int().positive().describe("ID of the lead to delete") },
        },
        async ({ id }) => {
          try {
            const record = await apiDelete<EduframeRecord>(`/leads/${id}`);
            void logResponse("delete_lead", { id }, record);
            return formatDelete(record, "lead");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    }
Behavior2/5

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

Annotations indicate readOnlyHint=false, destructiveHint=false, idempotentHint=false, but the description adds no behavioral context beyond stating the action. No mention of side effects, permissions, or error conditions.

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

Conciseness3/5

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

The description is extremely concise (one sentence), but it lacks structure and fails to provide key information. It is not overly long, but the brevity comes at the cost of completeness.

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 tool has 18 parameters, nested objects, and no output schema, the description is insufficient. It does not explain return values, required fields, or typical usage patterns.

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 94%, so the baseline is 3. The description does not add any additional meaning to the parameters beyond what is already in the schema.

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 'Create a lead.' clearly states the verb and resource, but it does not differentiate from other create tools like 'create_account' or 'create_user'. It is clear but lacks sibling differentiation.

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?

No guidance is provided on when to use this tool versus alternatives. No context, prerequisites, or exclusions are mentioned.

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/martijnpieters/eduframe-mcp'

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