Skip to main content
Glama

create_task

Define work types for time tracking by creating tasks that can be assigned to projects, specifying details like name, billable status, and hourly rates.

Instructions

Create a new task that can be assigned to projects for time tracking. Tasks define what type of work is being performed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesTask name (required)
billable_by_defaultNoWhether this task is billable by default
default_hourly_rateNoDefault hourly rate for this task
is_defaultNoWhether this is a default task
is_activeNoWhether the task is active

Implementation Reference

  • Implementation of the CreateTaskHandler which executes the tool logic.
    class CreateTaskHandler implements ToolHandler {
      constructor(private readonly config: BaseToolConfig) {}
    
      async execute(args: Record<string, any>): Promise<CallToolResult> {
        try {
          const validatedArgs = validateInput(CreateTaskSchema, args, 'create task');
          logger.info('Creating task via Harvest API');
          const task = await this.config.harvestClient.createTask(validatedArgs);
          
          return {
            content: [{ type: 'text', text: JSON.stringify(task, null, 2) }],
          };
        } catch (error) {
          return handleMCPToolError(error, 'create_task');
        }
      }
  • Input schema validation for creating a task.
    export const CreateTaskSchema = z.object({
      name: z.string().min(1, 'Task name is required'),
      billable_by_default: z.boolean().optional().default(true),
      default_hourly_rate: z.number().min(0).optional(),
      is_default: z.boolean().optional().default(false),
      is_active: z.boolean().optional().default(true),
    });
  • Registration of the 'create_task' tool with its schema definition and handler.
    {
      tool: {
        name: 'create_task',
        description: 'Create a new task that can be assigned to projects for time tracking. Tasks define what type of work is being performed.',
        inputSchema: {
          type: 'object',
          properties: {
            name: { type: 'string', minLength: 1, description: 'Task name (required)' },
            billable_by_default: { type: 'boolean', description: 'Whether this task is billable by default' },
            default_hourly_rate: { type: 'number', minimum: 0, description: 'Default hourly rate for this task' },
            is_default: { type: 'boolean', description: 'Whether this is a default task' },
            is_active: { type: 'boolean', description: 'Whether the task is active' },
          },
          required: ['name'],
          additionalProperties: false,
        },
      },
      handler: new CreateTaskHandler(config),
    },

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/ianaleck/harvest-mcp-server'

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