Skip to main content
Glama

generate_weekly_summary

Generate structured weekly productivity summaries by analyzing Slack, Calendar, and Gmail data to track progress and identify patterns.

Instructions

Generate a comprehensive weekly productivity summary from Slack, Calendar, and Gmail data. Returns structured summary with optional HTML/Markdown output.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
days_backNoNumber of days to analyze (default: 7)
start_dateNoOptional start date in YYYY-MM-DD format (overrides days_back)
end_dateNoOptional end date in YYYY-MM-DD format (default: today)
output_formatNoOutput format(s) to generate (default: both)both
save_to_fileNoWhether to save output to summaries directory (default: true)
include_sectionsNoSections to include (default: all)

Implementation Reference

  • Main handler function that orchestrates weekly summary generation: calculates date range, generates data collection instructions and template, processes collected data if provided, handles file output in HTML/Markdown, and returns structured result.
    export async function generateWeeklySummary(args) {
      const startTime = Date.now();
      
      try {
        // Calculate date range
        const { startDate, endDate, days } = calculateDateRange(args);
        
        const outputFormat = args.output_format || config.defaults.outputFormat;
        const saveToFile = args.save_to_file !== false;
        const includeSections = args.include_sections || ['executive', 'time', 'achievements', 'communication', 'todos', 'insights', 'metrics'];
        
        // Generate data collection instructions for the AI
        const instructions = generateDataCollectionInstructions(startDate, endDate);
        
        // Generate summary template
        const summaryTemplate = generateSummaryTemplate(startDate, endDate, days, includeSections);
        
        // Prepare response structure
        const result = {
          success: true,
          message: 'Weekly summary generation initiated. Please follow the data collection instructions below.',
          period: {
            start: startDate,
            end: endDate,
            days,
          },
          instructions,
          template: summaryTemplate,
          output_format: outputFormat,
          save_to_file: saveToFile,
          note: 'This tool provides instructions for the AI agent to collect data and generate the summary. The AI will make multiple MCP calls to gather Slack, Calendar, and Gmail data, then synthesize it into a comprehensive summary.',
        };
        
        // If the AI has already collected data (passed in args), process it
        if (args.collected_data) {
          result.summary = await processSummaryData(args.collected_data, startDate, endDate, days, includeSections);
          
          // Save to file if requested
          if (saveToFile) {
            const files = [];
            
            if (outputFormat === 'both' || outputFormat === 'html') {
              const htmlFilename = generateFilename(startDate, endDate, 'html');
              const htmlPath = await saveSummary(result.summary.html, htmlFilename);
              files.push(htmlPath);
            }
            
            if (outputFormat === 'both' || outputFormat === 'markdown') {
              const mdFilename = generateFilename(startDate, endDate, 'markdown');
              const mdPath = await saveSummary(result.summary.markdown, mdFilename);
              files.push(mdPath);
            }
            
            result.files_saved = files;
          }
        }
        
        result.generation_time_ms = Date.now() - startTime;
        
        return result;
        
      } catch (error) {
        throw {
          code: error.code || 'GENERATION_FAILED',
          message: error.message || 'Failed to generate summary',
          details: error.details || error.stack,
        };
      }
    }
  • JSON schema defining the input parameters and validation for the generate_weekly_summary tool.
    {
      name: 'generate_weekly_summary',
      description: 'Generate a comprehensive weekly productivity summary from Slack, Calendar, and Gmail data. Returns structured summary with optional HTML/Markdown output.',
      inputSchema: {
        type: 'object',
        properties: {
          days_back: {
            type: 'integer',
            description: 'Number of days to analyze (default: 7)',
            default: 7,
            minimum: 1,
            maximum: 90,
          },
          start_date: {
            type: 'string',
            description: 'Optional start date in YYYY-MM-DD format (overrides days_back)',
            pattern: '^\\d{4}-\\d{2}-\\d{2}$',
          },
          end_date: {
            type: 'string',
            description: 'Optional end date in YYYY-MM-DD format (default: today)',
            pattern: '^\\d{4}-\\d{2}-\\d{2}$',
          },
          output_format: {
            type: 'string',
            enum: ['both', 'html', 'markdown', 'json'],
            description: 'Output format(s) to generate (default: both)',
            default: 'both',
          },
          save_to_file: {
            type: 'boolean',
            description: 'Whether to save output to summaries directory (default: true)',
            default: true,
          },
          include_sections: {
            type: 'array',
            items: {
              type: 'string',
              enum: ['executive', 'time', 'achievements', 'communication', 'todos', 'insights', 'metrics'],
            },
            description: 'Sections to include (default: all)',
          },
        },
      },
    },
  • Registration in the central tool dispatcher: routes calls to 'generate_weekly_summary' to the specific handler function.
    case 'generate_weekly_summary':
      result = await generateWeeklySummary(args);
      break;
  • src/index.js:58-60 (registration)
    MCP server request handler for tool calls, which invokes the dispatcher handleToolCall based on tool name.
    // Handle the tool call (returns JSON string)
    const result = await handleToolCall(name, args || {});
  • Helper function that generates detailed data collection instructions for Slack, Calendar, and Gmail analyzers.
    function generateDataCollectionInstructions(startDate, endDate) {
      return `
    # Weekly Summary Data Collection
    
    To generate a comprehensive weekly summary for **${formatDisplayDate(startDate)} to ${formatDisplayDate(endDate)}**, please collect data from the following sources:
    
    ${getSlackDataInstructions(startDate, endDate)}
    
    ${getCalendarDataInstructions(startDate, endDate)}
    
    ${getGmailDataInstructions(startDate, endDate)}
    
    ## Next Steps
    
    1. Make the necessary MCP tool calls to collect data from each source
    2. Analyze the data to identify:
       - Key achievements and wins
       - Time allocation patterns
       - Communication trends
       - Outstanding action items
       - Insights and learnings
    3. Synthesize the findings into the summary template provided
    4. Generate both HTML and Markdown output formats
    
    ## Important Notes
    
    - Focus on **actionable insights** and **meaningful patterns**
    - Highlight **achievements** and **accomplishments**
    - Identify **blockers** and **challenges** that need attention
    - Extract **concrete action items** from messages and emails
    - Provide **context** for metrics and statistics
    `;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'Returns structured summary with optional HTML/Markdown output' and implies data aggregation, but lacks critical behavioral details: whether this is a read-only operation, if it requires specific permissions, processing time, rate limits, or what happens when 'save_to_file' is true. For a complex 6-parameter tool with no annotations, this is insufficient.

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 concise and front-loaded, stating the core purpose in the first clause. Both sentences are relevant: the first defines the tool's function, the second adds output details. There's no wasted text, though it could be slightly more structured for clarity.

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 the tool's complexity (6 parameters, data aggregation from multiple sources, no output schema, and no annotations), the description is incomplete. It doesn't explain the summary's structure, data sources' integration, error handling, or output behavior beyond format options. For a tool that likely involves significant processing and file operations, more context 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 parameters are well-documented in the schema. The description adds minimal value beyond the schema: it mentions 'optional HTML/Markdown output' which relates to 'output_format', and 'comprehensive weekly productivity summary' hints at 'include_sections'. However, it doesn't provide additional context about parameter interactions or semantics not in the 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: generating a comprehensive weekly productivity summary from specific data sources (Slack, Calendar, Gmail). It specifies the verb 'generate' and resource 'weekly productivity summary', but doesn't explicitly differentiate from siblings like 'generate_daily_summary' or 'get_summary' beyond the weekly focus.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'generate_daily_summary', 'get_quick_stats', and 'get_summary', there's no indication of comparative use cases, prerequisites, or exclusions. The agent must infer usage from the tool name alone.

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/philipbloch/summary-mcp'

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