Skip to main content
Glama

restart_timer

Restart a stopped timer by creating a new running time entry from an existing stopped entry. Provide the ID of the time entry to resume tracking.

Instructions

Restart a previously stopped timer, creating a new running time entry based on an existing entry.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the time entry to restart the timer for

Implementation Reference

  • The RestartTimerHandler class implements the ToolHandler interface. It validates args against RestartTimerSchema, calls harvestClient.restartTimer(), and returns the time entry data or handles errors.
    class RestartTimerHandler implements ToolHandler {
      constructor(private readonly config: BaseToolConfig) {}
    
      async execute(args: Record<string, any>): Promise<CallToolResult> {
        try {
          const validatedArgs = validateInput(RestartTimerSchema, args, 'restart timer');
          logger.info('Restarting timer via Harvest API', { timeEntryId: validatedArgs.id });
          const timeEntry = await this.config.harvestClient.restartTimer(validatedArgs);
          
          return {
            content: [{ type: 'text', text: JSON.stringify(timeEntry, null, 2) }],
          };
        } catch (error) {
          return handleMCPToolError(error, 'restart_timer');
        }
      }
    }
  • RestartTimerSchema defines the input validation schema: requires a positive integer 'id' for the time entry to restart.
    export const RestartTimerSchema = z.object({
      id: z.number().int().positive(), // Time entry ID to restart
    });
  • The 'restart_timer' tool is registered in registerTimeEntryTools() with its name, description, inputSchema (requiring 'id'), and the RestartTimerHandler instance.
    {
      tool: {
        name: 'restart_timer',
        description: 'Restart a previously stopped timer, creating a new running time entry based on an existing entry.',
        inputSchema: {
          type: 'object',
          properties: {
            id: { type: 'number', description: 'The ID of the time entry to restart the timer for' },
          },
          required: ['id'],
          additionalProperties: false,
        },
      },
      handler: new RestartTimerHandler(config),
    },
  • HarvestApi.restartTimer() is a passthrough method that delegates to timeEntriesClient.restartTimer().
    async restartTimer(input: RestartTimerInput): Promise<any> {
      return this.timeEntriesClient.restartTimer(input);
  • TimeEntriesClient.restartTimer() performs the actual HTTP PATCH request to /time_entries/{id}/restart, with input validation and error handling.
    async restartTimer(input: RestartTimerInput): Promise<any> {
      try {
        // Validate input
        const validatedInput = RestartTimerSchema.parse(input);
        
        this.logger.debug('Restarting timer', { timeEntryId: validatedInput.id });
        
        const response: AxiosResponse = await this.client.patch(`/time_entries/${validatedInput.id}/restart`);
        
        this.logger.info('Successfully restarted timer', {
          timeEntryId: response.data.id,
          projectId: response.data.project?.id,
          isRunning: response.data.is_running
        });
        
        return response.data;
      } catch (error) {
        if (error instanceof z.ZodError) {
          this.logger.error('Restart timer validation failed:', error.errors);
          throw new Error('Invalid timer restart data');
        }
        throw error;
      }
    }
Behavior3/5

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

The description discloses that it creates a new running time entry based on an existing entry, which is key behavior. However, without annotations, it does not explain other traits like required permissions, side effects on the original entry, or error conditions, leaving some gaps.

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

Conciseness5/5

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

The description is a single sentence that is concise and front-loaded with the essential action. No extraneous information is present, making it efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one parameter, no output schema), the description is fairly complete. It explains the core functionality. However, it could be slightly improved by mentioning the result or return type, or clarifying prerequisites like the timer must be stopped.

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 schema already covers the single parameter 'id' with a clear description. The tool description does not add additional meaning beyond what is in the schema, so the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Restart' and the resource 'timer', and distinguishes from siblings like start_timer and stop_timer by specifying that it restarts a previously stopped timer and creates a new entry based on an existing one.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description indicates that the tool is for restarting a stopped timer, but does not explicitly state when not to use it or compare with alternatives such as start_timer or create_time_entry. It provides implicit context but lacks explicit guidance.

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

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