Skip to main content
Glama

sun_get_summary

Retrieve saved conversation summaries to review key insights, outcomes, and next steps from chat sessions.

Instructions

Get content of a specific summary file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYesName of the summary file to retrieve

Implementation Reference

  • src/server.ts:80-94 (registration)
    Registration of the sun_get_summary tool in the ListToolsRequestSchema handler, defining name, description, and input schema.
      {
        name: 'sun_get_summary',
        description: 'Get content of a specific summary file',
        inputSchema: {
          type: 'object',
          properties: {
            filename: {
              type: 'string',
              description: 'Name of the summary file to retrieve',
            },
          },
          required: ['filename'],
        },
      },
    ] as Tool[],
  • Primary handler function for executing the sun_get_summary tool. It validates the filename argument, calls FileManager.getSummary to retrieve the file content, and formats the MCP response with the summary markdown or an error.
      private async handleGetSummary(args: any) {
        const { filename } = args;
    
        if (!filename) {
          throw new Error('Filename is required');
        }
    
        const content = await this.fileManager.getSummary(filename);
    
        if (!content) {
          return {
            content: [
              {
                type: 'text',
                text: `❌ 未找到文件: ${filename}`,
              },
            ],
          };
        }
    
        return {
          content: [
            {
              type: 'text',
              text: `📄 **${filename}**
    
    ${content}`,
            },
          ],
        };
      }
  • Input schema definition for the sun_get_summary tool, specifying an object with a required 'filename' string property.
    inputSchema: {
      type: 'object',
      properties: {
        filename: {
          type: 'string',
          description: 'Name of the summary file to retrieve',
        },
      },
      required: ['filename'],
    },
  • Core file retrieval logic invoked by the tool handler. Reads the specified .mdc summary file, parses its metadata, and returns a SavedSummaryFile object or null if not found.
    async getSummary(filename: string): Promise<SavedSummaryFile | null> {
      const filePath = path.join(this.sunDir, filename);
    
      try {
        const exists = await fs.pathExists(filePath);
        if (!exists) {
          return null;
        }
    
        const content = await fs.readFile(filePath, 'utf-8');
        const stats = await fs.stat(filePath);
        const summary = this.parseSummaryFromMarkdown(content, filename);
    
        return {
          filename,
          path: filePath,
          summary,
          createdAt: stats.birthtime.toISOString()
        };
      } catch (error) {
        console.error(`Failed to get summary ${filename}:`, error);
        return null;
      }
    }
  • Helper function that parses the markdown content of a summary file to extract structured SessionSummary data, supporting both English and Chinese.
    private parseSummaryFromMarkdown(content: string, filename: string): SessionSummary {
      // Detect language from content
      const isEnglish = content.includes('Session Overview') || content.includes('Timestamp');
    
      // Extract title (first # heading)
      const titleMatch = content.match(/^# (.+)$/m);
      const title = titleMatch ? titleMatch[1] : filename.replace('.mdc', '');
    
      // Extract basic info (support both languages)
      const timestampMatch = content.match(/\*\*(Timestamp|时间戳)\*\*: (.+)$/m);
      const statusMatch = content.match(/\*\*(Completion Status|完成状态)\*\*: (.+)$/m);
      const messageCountMatch = content.match(/\*\*(Message Count|消息数量)\*\*: (\d+)$/m);
    
      // Extract essence (support both languages)
      const essenceMatch = content.match(/## (Core Essence|核心精髓)\n([\s\S]*?)\n\n## /) ||
        content.match(/## (Core Essence|核心精髓)\n([\s\S]*?)$/);
      const essence = essenceMatch ? essenceMatch[2].trim() : '';
    
      // Extract key points (support both languages)
      const keyPointsMatch = content.match(/## (Key Points|关键要点)\n([\s\S]*?)\n\n## /) ||
        content.match(/## (Key Points|关键要点)\n([\s\S]*?)$/);
      const keyPoints = keyPointsMatch
        ? keyPointsMatch[2].split('\n').filter(line => line.startsWith('- ')).map(line => line.substring(2))
        : [];
    
      // Extract outcomes (support both languages)
      const outcomesMatch = content.match(/## (Outcomes|完成成果)\n([\s\S]*?)(\n\n## |\n\n---)/);
      const outcomes = outcomesMatch
        ? outcomesMatch[2].split('\n').filter(line => line.startsWith('- ')).map(line => line.substring(2))
        : [];
    
      return {
        title,
        essence,
        completionStatus: (statusMatch ? statusMatch[2] : 'unknown') as any,
        keyPoints,
        outcomes,
        timestamp: timestampMatch ? timestampMatch[2] : new Date().toISOString(),
        messageCount: messageCountMatch ? parseInt(messageCountMatch[2]) : 0,
        functionality: filename.split('_').slice(2).join('_').replace('.mdc', ''),
        language: isEnglish ? 'en' : 'zh'
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get content', implying a read-only operation, but does not specify if it requires authentication, has rate limits, returns errors for missing files, or details the output format (e.g., text, JSON). This leaves significant gaps in understanding how the tool behaves beyond basic retrieval.

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 a single, straightforward sentence: 'Get content of a specific summary file'. It is front-loaded and wastes no words, making it efficient. However, it could be slightly more informative without losing conciseness, such as hinting at the file type or source.

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 simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It does not explain what a 'summary file' is, how content is returned, or potential errors. For a retrieval tool, this lack of context makes it harder for an agent to use correctly without trial and error.

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?

The input schema has 100% description coverage, with the 'filename' parameter clearly documented. The description adds no additional meaning beyond the schema, such as examples of valid filenames or constraints. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description does not compensate but also does not detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Get content of a specific summary file', which clearly indicates it retrieves content from a file. However, it lacks specificity about what a 'summary file' entails (e.g., format, source) and does not differentiate from siblings like 'sun_list_summaries' (which likely lists files) or 'sun_summarize' (which might generate summaries). This makes the purpose somewhat vague but understandable.

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 its siblings. It does not mention prerequisites, such as needing to know the filename from 'sun_list_summaries', or alternatives like using 'sun_summarize' for creating summaries instead of retrieving them. Without any usage context, the agent must infer this from tool names 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/ChenYCL/sun-mcp'

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