Skip to main content
Glama

start_activity_log

Initiate activity tracking for AI coding tasks by creating timestamped logs with categorization for debugging, implementation, testing, and other development workflows.

Instructions

Start a new activity log with system timestamp and unique Time ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
activityTypeYesType of activity being performed (e.g., 'code_review', 'debugging', 'planning')
descriptionNoDetailed description of the activity
tagsNoTags for categorizing the activity
task_scopeYesScope of the task

Implementation Reference

  • The core handler function in the TimeServer class that creates a new ActivityLog entry with a unique ID, current UTC timestamp, saves it to the database, and returns the log object.
    def start_activity_log(
        self, 
        activity_type: str, 
        task_scope: TaskScope, 
        description: Optional[str] = None,
        tags: Optional[List[str]] = None
    ) -> ActivityLog:
        """Start a new activity log"""
        time_id = self.id_generator.generate_id()
        start_time = datetime.now(ZoneInfo('UTC')).isoformat(timespec="seconds")
        
        log = ActivityLog(
            activityId=time_id,  # Changed from timeId to activityId
            activityType=activity_type,
            task_scope=task_scope,
            description=description,
            tags=tags,
            startTime=start_time,
            status="started"
        )
        
        self.db.add_activity_log(log)
        return log
  • Pydantic BaseModel defining the structure and validation for ActivityLog objects used by the start_activity_log tool.
    class ActivityLog(BaseModel):
        activityId: str  # Changed from timeId for better naming
        activityType: str
        task_scope: TaskScope
        description: Optional[str] = None
        tags: Optional[List[str]] = None
        startTime: str
        endTime: Optional[str] = None
        duration: Optional[str] = None
        durationSeconds: Optional[int] = None
        result: Optional[str] = None
        notes: Optional[str] = None
        status: str  # "started", "completed"
  • JSON schema for input validation of the start_activity_log tool, registered in the list_tools() handler.
    Tool(
        name=TimeTools.START_ACTIVITY_LOG.value,
        description="Start a new activity log with system timestamp and unique Time ID",
        inputSchema={
            "type": "object",
            "properties": {
                "activityType": {
                    "type": "string",
                    "description": "Type of activity being performed (e.g., 'code_review', 'debugging', 'planning')",
                },
                "task_scope": {
                    "type": "string",
                    "enum": [scope.value for scope in TaskScope],
                    "description": "Scope of the task",
                },
                "description": {
                    "type": "string",
                    "description": "Detailed description of the activity",
                },
                "tags": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "Tags for categorizing the activity",
                },
            },
            "required": ["activityType", "task_scope"],
        },
    ),
  • Dispatch logic in the internal _execute_tool function that validates arguments and calls the start_activity_log handler.
    case TimeTools.START_ACTIVITY_LOG.value:
        if not all(k in arguments for k in ["activityType", "task_scope"]):
            raise ValueError("Missing required arguments: activityType and task_scope")
    
        result = time_server.start_activity_log(
            arguments["activityType"],
            TaskScope(arguments["task_scope"]),
            arguments.get("description"),
            arguments.get("tags"),
        )
  • Database helper method called by the handler to persist the new ActivityLog to JSON storage.
    def add_activity_log(self, log: ActivityLog):
        """Add a new activity log"""
        self.activity_logs.append(log.model_dump())
        self.save_data()

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/n0zer0d4y/chronos-protocol'

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