createContact
Add new contact records in Clay by providing details like name, email, phone, and LinkedIn handle. Use this endpoint exclusively for creating new contacts, not for adding to groups.
Instructions
Create a new contact record in Clay. This endpoint should only be used when you need to create a completely new contact, not for adding contacts to groups.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| birthday | No | The birthday of the contact. Use the format YYYY-MM-DD, if no year is specified use 0, month and day are required. | |
| No | The email of the contact. | ||
| first_name | No | The first name of the contact. | |
| last_name | No | The last name of the contact. | |
| No | The LinkedIn handle of the contact. | ||
| organization | No | The organization of the contact. | |
| phone | No | The phone number of the contact. | |
| title | No | The job title of the contact. | |
| website | No | The website of the contact. |
Implementation Reference
- index.js:237-237 (handler)Handler function for the 'createContact' tool. It proxies the parameters to the external Clay API endpoint '/create-contact' using the shared callTool helper, authenticating with the session's apiKey.execute: async (params, { session }) => callTool("/create-contact", params, session),
- index.js:203-236 (schema)Zod schema defining the input parameters for the createContact tool, including optional fields like names, phone, email, linkedin, etc.parameters: z.object({ first_name: z .string() .describe("The first name of the contact.") .optional(), last_name: z.string().describe("The last name of the contact.").optional(), phone: z .array(z.string()) .describe("The phone number of the contact.") .optional(), email: z .array(z.string()) .describe("The email of the contact.") .default([]), linkedin: z .string() .describe("The LinkedIn handle of the contact.") .optional(), website: z .array(z.string()) .describe("The website of the contact.") .default([]), title: z.string().describe("The job title of the contact.").optional(), organization: z .string() .describe("The organization of the contact.") .optional(), birthday: z .string() .describe( "The birthday of the contact. Use the format YYYY-MM-DD, if no year is specified use 0, month and day are required." ) .optional(), }),
- index.js:199-238 (registration)Registration of the 'createContact' MCP tool with FastMCP server.addTool, including name, description, input schema, and handler.server.addTool({ name: "createContact", description: "Create a new contact record in Clay. This endpoint should only be used when you need to create a completely new contact, not for adding contacts to groups.", parameters: z.object({ first_name: z .string() .describe("The first name of the contact.") .optional(), last_name: z.string().describe("The last name of the contact.").optional(), phone: z .array(z.string()) .describe("The phone number of the contact.") .optional(), email: z .array(z.string()) .describe("The email of the contact.") .default([]), linkedin: z .string() .describe("The LinkedIn handle of the contact.") .optional(), website: z .array(z.string()) .describe("The website of the contact.") .default([]), title: z.string().describe("The job title of the contact.").optional(), organization: z .string() .describe("The organization of the contact.") .optional(), birthday: z .string() .describe( "The birthday of the contact. Use the format YYYY-MM-DD, if no year is specified use 0, month and day are required." ) .optional(), }), execute: async (params, { session }) => callTool("/create-contact", params, session), });
- index.js:31-41 (helper)Shared helper function used by all tools (including createContact) to make authenticated POST requests to the external Clay API endpoints.async function callTool(path, params, session) { console.log('Calling tool', path, session) return fetch(`https://nexum.clay.earth/tools${path}`, { body: JSON.stringify(params), headers: { Authorization: `ApiKey ${session.apiKey}`, "Content-Type": "application/json", }, method: "POST", }).then((res) => res.text()); }