Skip to main content
Glama

get_activity_data

Retrieve your top applications and websites by time spent from RescueTime, including productivity classifications for each activity.

Instructions

Get top activities/applications by time spent.

Args: date_str: Date to query - 'today', 'yesterday', or 'YYYY-MM-DD' limit: Maximum number of activities to show (default: 10)

Shows which specific applications and websites you spent time on, ranked by duration. Includes productivity classification for each.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
date_strNotoday
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function for the 'get_activity_data' MCP tool. It is decorated with @mcp.tool() for automatic registration, fetches top activity data from the RescueTime API using RescueTimeClient, processes and formats the results with productivity indicators and durations, handles errors, and returns a formatted string summary of top activities.
    @mcp.tool()
    async def get_activity_data(date_str: str = "today", limit: int = 10) -> str:
        """Get top activities/applications by time spent.
    
        Args:
            date_str: Date to query - 'today', 'yesterday', or 'YYYY-MM-DD'
            limit: Maximum number of activities to show (default: 10)
    
        Shows which specific applications and websites you spent time on,
        ranked by duration. Includes productivity classification for each.
        """
        try:
            client = RescueTimeClient()
            resolved_date = resolve_date(date_str)
    
            activities = await client.get_analytic_data(
                restrict_kind="activity",
                perspective="rank",
                restrict_begin=resolved_date,
                restrict_end=resolved_date,
            )
    
            if not activities:
                return f"No activity data for {resolved_date}."
    
            lines = [f"Top Activities ({resolved_date}):", ""]
    
            for i, act in enumerate(activities[:limit], 1):
                prod_indicator = {
                    2: "[++]",
                    1: "[+ ]",
                    0: "[  ]",
                    -1: "[ -]",
                    -2: "[--]",
                }.get(act.productivity, "[??]")
    
                duration = format_duration(act.time_seconds)
                lines.append(f"{i:2}. {prod_indicator} {act.name}")
                lines.append(f"      {duration} | {act.category or 'Uncategorized'}")
    
            # Show totals
            total_seconds = sum(a.time_seconds for a in activities)
            lines.append("")
            lines.append(f"Total: {format_duration(total_seconds)} across {len(activities)} activities")
    
            return "\n".join(lines)
    
        except RescueTimeAuthError as e:
            return f"Authentication error: {e}"
        except RescueTimeAPIError as e:
            return f"API error: {e}"
  • Helper function used by get_activity_data to resolve date strings like 'today' or 'yesterday' into ISO date format for API queries.
    def resolve_date(date_str: str) -> str:
        """Resolve 'today', 'yesterday', or return as-is."""
        if date_str.lower() == "today":
            return date.today().isoformat()
        elif date_str.lower() == "yesterday":
            return (date.today() - timedelta(days=1)).isoformat()
        return date_str
  • Helper function used by get_activity_data to format time durations from seconds into human-readable 'Xh Ym' format.
    def format_duration(seconds: int) -> str:
        """Format seconds as 'Xh Ym'."""
        return format_hours_minutes(seconds / 3600)
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool shows 'specific applications and websites you spent time on, ranked by duration' and includes 'productivity classification for each,' which adds behavioral context about output format and ranking. However, it doesn't mention permissions, rate limits, or data freshness, which are gaps for a tool with zero annotation coverage.

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 well-structured and front-loaded with the core purpose, followed by parameter details and additional context. Every sentence adds value: the first states the purpose, the Args section clarifies parameters, and the last two sentences explain output details. No wasted words or redundancy.

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 moderate complexity (2 parameters, no annotations, but with an output schema), the description is fairly complete. It covers purpose, parameter semantics, and output behavior (ranking, productivity classification). The output schema likely handles return values, so the description doesn't need to detail them. Minor gaps include lack of error handling or data source context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaningful semantics for both parameters: date_str specifies allowed values ('today', 'yesterday', or 'YYYY-MM-DD') and limit explains its purpose ('Maximum number of activities to show') with a default. This goes beyond the schema's basic type/default info, though it doesn't cover all possible edge cases.

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 tool's purpose with specific verbs ('Get top activities/applications by time spent') and resources ('activities/applications'). It distinguishes from siblings by focusing on specific applications/websites ranked by duration, unlike category breakdowns, hourly productivity, trends, or summary tools.

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 implies usage through its purpose statement but doesn't explicitly state when to use this tool versus alternatives like get_category_breakdown or get_today_summary. No explicit when-not or alternative guidance is provided, leaving usage context inferred rather than clearly defined.

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/JasonBates/rescuetime-mcp'

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