Skip to main content
Glama

matrix_time_analysis

Analyze time spent across Matrix entries by grouping data into topics, bugs, weeks, or days. Tracks total time using markers like [30m] or [2h] from entries to provide insights into time allocation.

Instructions

Analyze time spent across Matrix entries. Tracks total time by topic, bug UID, or week. Parses time markers like [30m], [2h] from entries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startDateNoStart date YYYY-MM-DD (optional, defaults to beginning)
endDateNoEnd date YYYY-MM-DD (optional, defaults to today)
groupByNoHow to group the analysis

Implementation Reference

  • Handler for the matrix_time_analysis tool. Forwards the tool arguments to the Google Apps Script API endpoint 'matrixTimeAnalysis' using the callAPI helper function.
    case "matrix_time_analysis":
      result = await callAPI("matrixTimeAnalysis", args);
      break;
  • Input schema for the matrix_time_analysis tool, defining optional parameters startDate, endDate, and groupBy with enum values.
    inputSchema: {
      type: "object",
      properties: {
        startDate: {
          type: "string",
          description: "Start date YYYY-MM-DD (optional, defaults to beginning)"
        },
        endDate: {
          type: "string",
          description: "End date YYYY-MM-DD (optional, defaults to today)"
        },
        groupBy: {
          type: "string",
          description: "How to group the analysis",
          enum: ["topic", "bug", "week", "day"]
        }
      }
    }
  • index.js:517-538 (registration)
    Registration of the matrix_time_analysis tool in the MCP server's ListTools response, including name, description, and input schema.
    {
      name: "matrix_time_analysis",
      description: "Analyze time spent across Matrix entries. Tracks total time by topic, bug UID, or week. Parses time markers like [30m], [2h] from entries.",
      inputSchema: {
        type: "object",
        properties: {
          startDate: {
            type: "string",
            description: "Start date YYYY-MM-DD (optional, defaults to beginning)"
          },
          endDate: {
            type: "string",
            description: "End date YYYY-MM-DD (optional, defaults to today)"
          },
          groupBy: {
            type: "string",
            description: "How to group the analysis",
            enum: ["topic", "bug", "week", "day"]
          }
        }
      }
    },
  • Helper function callAPI used by all proxied tools, including matrix_time_analysis, to make HTTP POST requests to the Google Apps Script web app.
    async function callAPI(action, data = {}) {
      debugLog('=== API CALL START ===');
      debugLog(`Action: ${action}`);
      debugLog(`Data: ${JSON.stringify(data)}`);
    
      try {
        // Build form-encoded body for POST
        const formData = new URLSearchParams();
        formData.append('action', action);
    
        // Add all data fields to form
        for (const [key, value] of Object.entries(data)) {
          if (value !== undefined && value !== null) {
            formData.append(key, value.toString());
          }
        }
    
        const formString = formData.toString();
        debugLog(`FormData: ${formString}`);
        debugLog(`API_URL: ${API_URL}`);
    
        // Use POST with proper content type
        const response = await fetch(API_URL, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
          },
          body: formString
        });
    
        debugLog(`Response status: ${response.status}`);
        debugLog(`Response ok: ${response.ok}`);
    
        if (!response.ok) {
          debugLog(`Response not OK: ${response.status} ${response.statusText}`);
          throw new Error(`API request failed: ${response.status} ${response.statusText}`);
        }
    
        const text = await response.text();
        debugLog(`Response text length: ${text.length}`);
        debugLog(`Response text: ${text}`);
    
        if (!text) {
          debugLog('ERROR: Empty response from API');
          throw new Error('Empty response from API');
        }
    
        const parsed = JSON.parse(text);
        debugLog(`Parsed successfully: ${JSON.stringify(parsed)}`);
        debugLog('=== API CALL END ===');
        return parsed;
    
      } catch (error) {
        debugLog(`ERROR in callAPI: ${error.message}`);
        debugLog(`ERROR stack: ${error.stack}`);
        throw error;
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions parsing time markers and grouping analysis, but doesn't describe output format, error handling, or performance characteristics. For a tool with 3 parameters and no output schema, this leaves significant gaps in understanding how results are returned.

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 efficiently structured in two sentences: the first states the core purpose and grouping options, the second explains the parsing mechanism. Every sentence adds value with zero waste, making it easy to scan and understand.

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

Completeness2/5

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

Given 3 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the analysis output looks like, how time markers are parsed, or any limitations. For a tool that performs analysis with multiple grouping options, more context about result format and behavior is needed.

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?

Schema description coverage is 100%, so the schema already documents all parameters with descriptions and enum values. The description adds marginal value by mentioning 'tracks total time by topic, bug UID, or week' which aligns with the groupBy parameter, but doesn't provide additional syntax or format details beyond what the schema provides.

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: 'Analyze time spent across Matrix entries' with specific actions like tracking total time by topic, bug UID, or week, and parsing time markers. It distinguishes from siblings by focusing on time analysis rather than general matrix operations like query_matrix or matrix_daily_summary, though it doesn't explicitly name alternatives.

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 for analyzing time from Matrix entries with time markers, but doesn't explicitly state when to use this tool versus alternatives like matrix_daily_summary or query_matrix. No exclusions or prerequisites are mentioned, leaving the agent to infer context from the tool's name and description.

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/PromptishOperations/mcpSpec'

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