Skip to main content
Glama

createCompany

Set up a new company by providing essential details like name, address, email, and tags. This tool simplifies company creation for Teamwork MCP users.

Instructions

Create a new company. This tool allows you to create a company. The request requires a companyRequest object with various properties like addressOne, emailOne, name, and tags.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companyRequestYes
optionsNoAdditional options for the request

Implementation Reference

  • The handler function that executes the createCompany tool logic. It extracts company data from input, validates name, calls the teamwork service to create the company, and returns the result or error message.
    export async function handleCreateCompany(input: any) { logger.info('Calling teamworkService.createCompany()'); try { const companyData = input.companyRequest; if (!companyData || !companyData.name) { throw new Error("Company name is required"); } const result = await teamworkService.createCompany(companyData); logger.info(`Company created successfully with name: ${companyData.name}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { logger.error(`Error in createCompany handler: ${error.message}`); return { content: [{ type: "text", text: `Error creating company: ${error.message}` }] }; } }
  • The tool definition including name, description, inputSchema for companyRequest with properties like name, address, email, etc., and annotations.
    export const createCompanyDefinition = { name: "createCompany", description: "Create a new company. This tool allows you to create a company. The request requires a companyRequest object with various properties like addressOne, emailOne, name, and tags.", inputSchema: { type: 'object', properties: { companyRequest: { type: 'object', properties: { addressOne: { type: 'string', description: 'First line of address' }, addressTwo: { type: 'string', description: 'Second line of address' }, city: { type: 'string', description: 'City' }, company: { type: 'object', properties: { name: { type: 'string', description: 'Company name' } }, required: ['name'] }, countryCode: { type: 'string', description: 'Country code' }, emailOne: { type: 'string', description: 'First email address' }, emailTwo: { type: 'string', description: 'Second email address' }, fax: { type: 'string', description: 'Fax number' }, name: { type: 'string', description: 'Company name' }, phone: { type: 'string', description: 'Phone number' }, state: { type: 'string', description: 'State' }, tags: { type: 'array', items: { type: 'string' }, description: 'List of tags' }, website: { type: 'string', description: 'Website URL' }, zip: { type: 'string', description: 'ZIP/Postal code' } }, required: ['name'] }, options: { type: 'object', properties: {}, description: 'Additional options for the request' } }, required: ['companyRequest'] }, annotations: { title: "Create Company", readOnlyHint: false, destructiveHint: false, openWorldHint: false } };
  • Registration of the createCompany tool in the central toolPairs array, associating the definition with its handler function.
    { definition: createCompany, handler: handleCreateCompany },
  • Supporting service function that performs the actual API call to create a company in Teamwork, called by the tool handler.
    export const createCompany = async (companyData: any) => { try { logger.info(`Creating new company with name: ${companyData.name}`); const api = ensureApiClient(); const response = await api.post('companies.json', companyData); logger.info(`Successfully created company. Response status: ${response.status}`); return response.data; } catch (error: any) { logger.error(`Error creating company: ${error.message}`); throw new Error(`Failed to create company: ${error.message}`); } };

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/Vizioz/Teamwork-MCP'

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