Skip to main content
Glama

get_summary

Retrieve weekly productivity summaries from Slack, Google Calendar, and Gmail by specifying a filename or date range in HTML, Markdown, or both formats.

Instructions

Retrieve a specific weekly summary by filename or date range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameNoFilename of the summary to retrieve
start_dateNoStart date to find summary (YYYY-MM-DD)
end_dateNoEnd date to find summary (YYYY-MM-DD)
formatNoFormat to retrieve (default: both)both
include_contentNoInclude full content or just metadata (default: true)

Implementation Reference

  • The core handler function that retrieves a summary file by filename or constructs filename from date range, checks existence, parses metadata, and optionally includes content in HTML and/or Markdown formats. Handles errors like file not found or format mismatch.
    export async function getSummary(args) {
      try {
        let filename = args.filename;
        const format = args.format || 'both';
        const includeContent = args.include_content !== false;
        
        // If no filename provided, try to construct from date range
        if (!filename && args.start_date && args.end_date) {
          // Try HTML first, then markdown
          const htmlFilename = generateFilename(args.start_date, args.end_date, 'html');
          const mdFilename = generateFilename(args.start_date, args.end_date, 'markdown');
          
          if (fileExists(htmlFilename)) {
            filename = htmlFilename;
          } else if (fileExists(mdFilename)) {
            filename = mdFilename;
          } else {
            throw {
              code: 'FILE_NOT_FOUND',
              message: 'No summary found for the specified date range',
              details: `Looked for: ${htmlFilename} and ${mdFilename}`,
            };
          }
        }
        
        if (!filename) {
          throw {
            code: 'MISSING_PARAMETER',
            message: 'Either filename or start_date/end_date must be provided',
          };
        }
        
        // Check if file exists
        if (!fileExists(filename)) {
          throw {
            code: 'FILE_NOT_FOUND',
            message: `Summary not found: ${filename}`,
            details: 'Use list_summaries to see available summaries',
          };
        }
        
        // Parse metadata from filename
        const dateRange = parseDateRangeFromFilename(filename);
        const fileFormat = filename.endsWith('.html') ? 'html' : 'markdown';
        const size = await getFileSize(filename);
        
        const result = {
          success: true,
          summary: {
            filename,
            format: fileFormat,
            period: dateRange ? {
              start: dateRange.startDate,
              end: dateRange.endDate,
              display: `${formatDisplayDate(dateRange.startDate)} to ${formatDisplayDate(dateRange.endDate)}`,
            } : null,
            size_bytes: size,
          },
        };
        
        // Include content if requested
        if (includeContent) {
          const content = await readSummary(filename);
          
          if (format === 'both') {
            // Try to read both formats
            if (fileFormat === 'html') {
              result.summary.html_content = content;
              
              // Try to find markdown version
              const mdFilename = filename.replace('.html', '.md');
              if (fileExists(mdFilename)) {
                result.summary.markdown_content = await readSummary(mdFilename);
              }
            } else {
              result.summary.markdown_content = content;
              
              // Try to find HTML version
              const htmlFilename = filename.replace('.md', '.html');
              if (fileExists(htmlFilename)) {
                result.summary.html_content = await readSummary(htmlFilename);
              }
            }
          } else if (format === fileFormat) {
            result.summary.content = content;
          } else {
            throw {
              code: 'FORMAT_MISMATCH',
              message: `Requested format '${format}' but file is '${fileFormat}'`,
              details: `Try requesting format: '${fileFormat}' or 'both'`,
            };
          }
        }
        
        return result;
        
      } catch (error) {
        if (error.code) {
          throw error;
        }
        throw {
          code: 'GET_FAILED',
          message: 'Failed to retrieve summary',
          details: error.message,
        };
      }
    }
  • Input schema definition for the get_summary tool, specifying parameters such as filename, start_date, end_date, format, and include_content with types, descriptions, and defaults.
    {
      name: 'get_summary',
      description: 'Retrieve a specific weekly summary by filename or date range.',
      inputSchema: {
        type: 'object',
        properties: {
          filename: {
            type: 'string',
            description: 'Filename of the summary to retrieve',
          },
          start_date: {
            type: 'string',
            description: 'Start date to find summary (YYYY-MM-DD)',
            pattern: '^\\d{4}-\\d{2}-\\d{2}$',
          },
          end_date: {
            type: 'string',
            description: 'End date to find summary (YYYY-MM-DD)',
            pattern: '^\\d{4}-\\d{2}-\\d{2}$',
          },
          format: {
            type: 'string',
            enum: ['html', 'markdown', 'both'],
            description: 'Format to retrieve (default: both)',
            default: 'both',
          },
          include_content: {
            type: 'boolean',
            description: 'Include full content or just metadata (default: true)',
            default: true,
          },
        },
      },
    },
  • Dispatch registration in the handleToolCall switch statement that routes 'get_summary' tool calls to the getSummary implementation.
    case 'get_summary':
      result = await getSummary(args);
      break;
  • Import statement registering the getSummary handler function for use in tool dispatching.
    import { getSummary } from './get-summary.js';
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 states it 'retrieves' a summary, implying a read operation, but doesn't disclose any behavioral traits such as error handling (e.g., what happens if no summary matches), performance characteristics, rate limits, or authentication needs. It lacks details on what 'retrieve' entails beyond the basic action.

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 a single, efficient sentence that front-loads the core purpose ('Retrieve a specific weekly summary') and adds necessary qualification ('by filename or date range'). There's zero waste, and it's appropriately sized for the tool's complexity.

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 has 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain the return format, error conditions, or how parameters interact (e.g., whether 'filename' overrides 'date range'). For a retrieval tool with multiple input options, more context is needed to guide effective use.

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 fully documents all parameters. The description adds minimal value by mentioning 'filename or date range', which loosely maps to parameters but doesn't provide additional semantics beyond what's in the schema (e.g., it doesn't explain interactions between parameters or usage scenarios). Baseline 3 is appropriate as the schema does the heavy lifting.

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 action ('Retrieve') and resource ('weekly summary'), specifying it can be retrieved by 'filename or date range'. It distinguishes from siblings like 'list_summaries' (which likely lists multiple) by focusing on retrieving a specific summary. However, it doesn't explicitly differentiate from 'get_quick_stats' or 'compare_periods', keeping it at 4 rather than 5.

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. It doesn't mention when to choose 'filename' vs 'date range', or how it differs from 'list_summaries' (which might list multiple summaries) or 'get_quick_stats' (which might provide aggregated data). There's no explicit context or exclusions provided.

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