Skip to main content
Glama

createCompany

Create a new company by providing required details such as name, address, and tags. Automatically adds the company to your Teamwork account.

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 main tool handler function that receives input, extracts companyRequest, validates that name is present, calls the service layer, and returns the result formatted as MCP content.
    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) {
        return createErrorResponse(error, 'Creating company');
      }
    } 
  • Tool definition including name 'createCompany', description, and inputSchema defining the expected companyRequest object with fields like addressOne, city, company, emailOne, name, phone, tags, website, zip, etc.
    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 in toolHandlersMap that maps the tool name 'createCompany' to the handleCreateCompany function.
    export const toolHandlersMap: Record<string, Function> = toolPairs.reduce((map, pair) => {
      map[pair.definition.name] = pair.handler;
      return map;
    }, {} as Record<string, Function>);
  • Tool pair registration linking createCompanyDefinition and handleCreateCompany in the toolPairs array.
    const toolPairs: ToolPair[] = [
      { definition: getProjects, handler: handleGetProjects },
      { definition: getCurrentProject, handler: handleGetCurrentProject },
      { definition: createProject, handler: handleCreateProject },
      { definition: getTasks, handler: handleGetTasks },
      { definition: getTasksByProjectId, handler: handleGetTasksByProjectId },
      { definition: getTaskListsByProjectId, handler: handleGetTaskListsByProjectId },
      { definition: getTasksByTaskListId, handler: handleGetTasksByTaskListId },
      { definition: getTaskById, handler: handleGetTaskById },
      { definition: createTask, handler: handleCreateTask },
      { definition: createSubTask, handler: handleCreateSubTask },
      { definition: updateTask, handler: handleUpdateTask },
      { definition: deleteTask, handler: handleDeleteTask },
      { definition: getTasksMetricsComplete, handler: handleGetTasksMetricsComplete },
      { definition: getTasksMetricsLate, handler: handleGetTasksMetricsLate },
      { definition: getTaskSubtasks, handler: handleGetTaskSubtasks },
      { definition: getTaskComments, handler: handleGetTaskComments },
      { definition: createComment, handler: handleCreateComment },
      { definition: getPeople, handler: handleGetPeople },
      { definition: getPersonById, handler: handleGetPersonById },
      { definition: getProjectPeople, handler: handleGetProjectPeople },
      { definition: addPeopleToProject, handler: handleAddPeopleToProject },
      { definition: deletePerson, handler: handleDeletePerson },
      { definition: updatePerson, handler: handleUpdatePerson },
      { definition: createCompany, handler: handleCreateCompany },
      { definition: updateCompany, handler: handleUpdateCompany },
      { definition: deleteCompany, handler: handleDeleteCompany },
      { definition: getCompanies, handler: handleGetCompanies },
      { definition: getCompanyById, handler: handleGetCompanyById },
      { definition: getProjectsPeopleMetricsPerformance, handler: handleGetProjectsPeopleMetricsPerformance },
      { definition: getProjectsPeopleUtilization, handler: handleGetProjectsPeopleUtilization },
      { definition: getAllocationTime, handler: handleGetProjectsAllocationsTime },
      { definition: getTime, handler: handleGetTime },
      { definition: getProjectPerson, handler: handleGetProjectPerson },
      { definition: getProjectsReportingUserTaskCompletion, handler: handleGetProjectsReportingUserTaskCompletion },
      { definition: getProjectsReportingUtilization, handler: handleGetProjectsReportingUtilization },
      { definition: getTimezones, handler: handleGetTimezones }
    ];
  • Service layer function that calls the Teamwork API (POST companies.json) with the company data to create a new company.
    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}`);
      }
    };
  • Tool group configuration listing 'createCompany' under the 'Companies' group for permission/group-based filtering.
    // Define a mapping of group names to tool names
    const toolGroups: Record<string, string[]> = {
      'Projects': ['getProjects', 'getCurrentProject', 'createProject'],
      'Tasks': ['getTasks', 'getTasksByProjectId', 'getTaskListsByProjectId', 'getTaskById', 'createTask', 'createSubTask', 'updateTask', 'deleteTask', 'getTasksMetricsComplete', 'getTasksMetricsLate', 'getTaskSubtasks', 'getTaskComments'],
      'People': ['getPeople', 'getPersonById', 'getProjectPeople', 'addPeopleToProject', 'deletePerson', 'getProjectsPeopleMetricsPerformance', 'getProjectsPeopleUtilization', 'getProjectPerson'],
      'Reporting': ['getProjectsReportingUserTaskCompletion', 'getProjectsReportingUtilization'],
      'Time': ['getTime', 'getProjectsAllocationsTime', 'getTimezones'],
      'Comments': ['createComment'],
      'Companies': ['createCompany', 'updateCompany', 'deleteCompany', 'getCompanies', 'getCompanyById']
    };
Behavior3/5

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

Annotations already indicate it is not read-only (readOnlyHint: false) and not destructive (destructiveHint: false). The description adds that it creates a company, which is consistent, but does not disclose behavioral details like idempotency, duplicate handling, or side effects.

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 two sentences, but the second sentence largely repeats the first. It could be more concise without losing meaning, e.g., 'Create a company using a companyRequest object with properties like address, email, name, and tags.'

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 nested object structure and lack of output schema, the description fails to clarify that 'name' is required within the nested 'company' object, and does not describe the return value. It omits important context for selecting and invoking the tool correctly.

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?

The input schema has detailed descriptions for many properties (90% coverage by my count), so the description's mention of a few properties adds little value. The schema already defines the companyRequest object structure, making the description's contribution marginal.

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 'Create a new company' with a specific verb and resource. It is distinct from siblings like updateCompany and deleteCompany, but the description is somewhat redundant and lacks additional specificity.

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, such as updateCompany or deleteCompany. There is no mention of prerequisites, error handling, or 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/Vizioz/Teamwork-MCP'

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