Skip to main content
Glama

summarize_transcript

Summarize video transcripts into LinkedIn posts by adjusting tone, audience focus, and length to create professional content from video material.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
transcriptYesVideo transcript text
toneNoTone of the summaryprofessional
audienceNoTarget audience for the summarygeneral
wordCountNoApproximate word count for the summary

Implementation Reference

  • Core handler function that executes the transcript summarization using OpenAI API, handling truncation and prompt engineering.
    export async function summarizeTranscript(transcript, tone, audience, wordCount, apiKey) {
      if (!apiKey) {
        throw new Error("OpenAI API key not provided");
      }
      
      if (!transcript || transcript.trim().length === 0) {
        throw new Error("Empty transcript provided");
      }
      
      console.log(`Summarizing transcript (${transcript.length} chars) with tone: ${tone}, audience: ${audience}`);
      
      try {
        // Initialize OpenAI client with provided API key
        const openai = new OpenAI({
          apiKey: apiKey,
        });
        
        // Truncate transcript if it's too long (to fit within token limits)
        const truncatedTranscript = truncateText(transcript, 15000);
        
        const response = await openai.chat.completions.create({
          model: "gpt-3.5-turbo",
          messages: [
            {
              role: "system",
              content: `You are a professional content summarizer. Summarize the provided transcript in a ${tone} tone for a ${audience} audience. 
              The summary should be approximately ${wordCount} words and capture the key points, insights, and valuable information from the transcript.
              Focus on making the summary concise, informative, and engaging.`
            },
            {
              role: "user",
              content: `Please summarize the following video transcript:\n\n${truncatedTranscript}`
            }
          ],
          temperature: 0.7,
          max_tokens: 500
        });
        
        if (response.choices && response.choices.length > 0) {
          return response.choices[0].message.content.trim();
        } else {
          throw new Error("No summary generated");
        }
      } catch (error) {
        console.error("Summarization error:", error);
        throw new Error(`Failed to summarize transcript: ${error.message}`);
      }
    }
  • src/server.js:113-164 (registration)
    MCP tool registration for 'summarize_transcript', including input schema, handler wrapper, and description.
    server.tool(
      "summarize_transcript",
      { 
        transcript: z.string().describe("Video transcript text"),
        tone: z.enum(["educational", "inspirational", "professional", "conversational"])
          .default("professional")
          .describe("Tone of the summary"),
        audience: z.enum(["general", "technical", "business", "academic"])
          .default("general")
          .describe("Target audience for the summary"),
        wordCount: z.number().min(100).max(300).default(200)
          .describe("Approximate word count for the summary")
      },
      async ({ transcript, tone, audience, wordCount }) => {
        try {
          // Check if OpenAI API key is set
          if (!apiKeyManager.hasOpenAIKey()) {
            throw new Error("OpenAI API key not set. Please use the set_api_keys tool first.");
          }
          
          const summary = await summarizeTranscript(
            transcript, 
            tone, 
            audience, 
            wordCount, 
            apiKeyManager.getOpenAIKey()
          );
          
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({
                success: true,
                summary
              }, null, 2)
            }]
          };
        } catch (error) {
          return {
            content: [{ 
              type: "text", 
              text: JSON.stringify({
                success: false,
                error: error.message
              }, null, 2)
            }],
            isError: true
          };
        }
      },
      { description: "Summarize a video transcript" }
    );
  • Zod input schema defining parameters for the summarize_transcript tool.
    { 
      transcript: z.string().describe("Video transcript text"),
      tone: z.enum(["educational", "inspirational", "professional", "conversational"])
        .default("professional")
        .describe("Tone of the summary"),
      audience: z.enum(["general", "technical", "business", "academic"])
        .default("general")
        .describe("Target audience for the summary"),
      wordCount: z.number().min(100).max(300).default(200)
        .describe("Approximate word count for the summary")
    },
  • Helper function to truncate long transcripts to fit token limits, used in the handler.
    /**
     * Truncate text to a maximum character length
     * @param {string} text - Text to truncate
     * @param {number} maxLength - Maximum length in characters
     * @returns {string} - Truncated text
     */
    function truncateText(text, maxLength) {
      if (text.length <= maxLength) return text;
      
      // Try to truncate at a sentence boundary
      const truncated = text.substring(0, maxLength);
      const lastPeriod = truncated.lastIndexOf('.');
      
      if (lastPeriod > maxLength * 0.8) {
        return truncated.substring(0, lastPeriod + 1);
      }
      
      return truncated + "...";
    }
Behavior1/5

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

Tool has no description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness1/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Tool has no description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has no description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/NvkAnirudh/LinkedIn-Post-Generator'

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