Skip to main content
Glama

get_category_breakdown

Retrieve time allocation by productivity category for a specific date to analyze work patterns and identify optimization opportunities.

Instructions

Get time spent by category.

Args: date_str: Date to query - 'today', 'yesterday', or 'YYYY-MM-DD'

Shows high-level categories like Software Development, Communication, Reference & Learning, etc. with time and productivity classification.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
date_strNotoday

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function for the 'get_category_breakdown' tool, decorated with @mcp.tool() for registration. It handles input date resolution, API call to fetch category data, computes visualizations and percentages, and returns a formatted string output.
    @mcp.tool()
    async def get_category_breakdown(date_str: str = "today") -> str:
        """Get time spent by category.
    
        Args:
            date_str: Date to query - 'today', 'yesterday', or 'YYYY-MM-DD'
    
        Shows high-level categories like Software Development, Communication,
        Reference & Learning, etc. with time and productivity classification.
        """
        try:
            client = RescueTimeClient()
            resolved_date = resolve_date(date_str)
    
            categories = await client.get_analytic_data(
                restrict_kind="category",
                perspective="rank",
                restrict_begin=resolved_date,
                restrict_end=resolved_date,
            )
    
            if not categories:
                return f"No category data for {resolved_date}."
    
            lines = [f"Category Breakdown ({resolved_date}):", ""]
    
            total_seconds = sum(c.time_seconds for c in categories)
    
            for cat in categories:
                duration = format_duration(cat.time_seconds)
                percentage = (cat.time_seconds / total_seconds * 100) if total_seconds > 0 else 0
                prod_label = cat.productivity_label
    
                # Visual bar based on percentage
                bar_len = int(percentage / 5)
                bar = "\u2588" * bar_len
    
                lines.append(f"{cat.name}")
                lines.append(f"  {bar} {duration} ({percentage:.0f}%) - {prod_label}")
    
            lines.append("")
            lines.append(f"Total: {format_duration(total_seconds)}")
    
            return "\n".join(lines)
    
        except RescueTimeAuthError as e:
            return f"Authentication error: {e}"
        except RescueTimeAPIError as e:
            return f"API error: {e}"
Behavior2/5

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

With no annotations provided, the description carries full burden but provides minimal behavioral context. It mentions what data is shown (categories with time and productivity classification) but doesn't disclose important behavioral traits like whether this is a read-only operation, authentication requirements, rate limits, or what happens with invalid dates. The description doesn't contradict annotations since none exist.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose. The parameter documentation is structured clearly with 'Args:' section. While efficient, the second paragraph about categories could be more tightly integrated with the main purpose statement.

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 (single parameter, categorical analysis), the presence of an output schema, and the description's good parameter coverage, this is reasonably complete. The description explains what the tool returns (categories with time and productivity classification), which complements the output schema. However, more behavioral context would improve completeness.

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

Parameters5/5

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

With 0% schema description coverage and only 1 parameter, the description fully compensates by providing complete parameter semantics. It explains the date_str parameter's purpose, format options ('today', 'yesterday', or 'YYYY-MM-DD'), and even provides a default value. This adds significant value beyond the bare schema.

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 the tool's purpose: 'Get time spent by category' with specific resource (time) and classification (by category). It distinguishes from siblings by focusing on categorical breakdown rather than hourly data, trends, or summaries. However, it doesn't explicitly contrast with each sibling tool.

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 context through the parameter explanation and examples of categories returned, but doesn't explicitly state when to use this tool versus alternatives like get_hourly_productivity or get_productivity_trend. No exclusions or prerequisites are mentioned.

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