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';

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