Skip to main content
Glama
mtct

MCP Journaling Server

by mtct

generate_session_summary

Transform chat conversations into concise markdown summaries for easy reference and continuity in journaling sessions using the MCP Journaling Server.

Instructions

Generate a markdown summary of the journaling session.

Args: summary: The llm generated summay of the conversation

Returns: str: Confirmation message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
summaryYes

Implementation Reference

  • The handler function for the 'generate_session_summary' tool. Decorated with @mcp.tool() for registration. It formats the global conversation_log into a markdown journal entry, appends the provided 'summary' as emotional analysis, saves it via save_journal_entry, and returns a confirmation.
    @mcp.tool() async def generate_session_summary(summary: str) -> str: """ Generate a markdown summary of the journaling session. Args: summary: The llm generated summay of the conversation Returns: str: Confirmation message """ if not conversation_log: return "No conversation to summarize. Please start a new session first." lines = [] # Add header with date today = datetime.now().strftime("%B %d, %Y") lines.append(f"# Journal Entry - {today}\n") # Add conversation transcript lines.append("## Conversation\n") for entry in conversation_log: speaker = "You" if entry["speaker"] == "user" else "Assistant" timestamp = datetime.fromisoformat(entry["timestamp"]).strftime("%H:%M") lines.append(f"**{speaker} ({timestamp})**: {entry['message']}\n") # Add reflection prompt for emotional analysis lines.append("\n## Emotional Analysis\n") lines.append(summary) file_text = "\n".join(lines) await save_journal_entry(file_text) return "Conversation saved to journal"
  • Helper function called by generate_session_summary to append the formatted journal content to a file in the configured journal directory.
    async def save_journal_entry(content: str, filepath: str = None) -> str: """ Save journal content to a markdown file. Args: content: The journal content to save filepath: Optional filepath to save the journal. If not specified, a new file with current date will be created in the configured directory. Returns: str: Confirmation message with filepath """ try: # Get and validate filepath path = config.resolve_filepath(filepath) # Ensure directory exists path.parent.mkdir(parents=True, exist_ok=True) # Write content with open(path, 'a', encoding='utf-8') as file: file.write(content + "\n\n") return f"Journal saved to: {path}" except ValueError as e: return f"Invalid filepath: {str(e)}" except Exception as e: return f"Error saving journal: {str(e)}"

Other Tools

Related 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/mtct/journaling_mcp'

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