Skip to main content
Glama

add-slide-title-content

Add a new slide with a title and structured content to an existing PowerPoint presentation. Specify the presentation name, slide title, and content with main and sub-points formatted for clarity.

Instructions

Add a new slide with a title and content to an existing presentation

Input Schema

NameRequiredDescriptionDefault
contentYesContent/body text of the slide. Separate main points with a single carriage return character.Make sub-points with tab character.Do not use bullet points, asterisks or dashes for points.Max main points is 4
presentation_nameYesName of the presentation to add the slide to
titleYesTitle of the slide

Input Schema (JSON Schema)

{ "properties": { "content": { "description": "Content/body text of the slide. Separate main points with a single carriage return character.Make sub-points with tab character.Do not use bullet points, asterisks or dashes for points.Max main points is 4", "type": "string" }, "presentation_name": { "description": "Name of the presentation to add the slide to", "type": "string" }, "title": { "description": "Title of the slide", "type": "string" } }, "required": [ "presentation_name", "title", "content" ], "type": "object" }

Implementation Reference

  • Registration of the 'add-slide-title-content' tool in list_tools(), including name, description, and input schema.
    types.Tool( name="add-slide-title-content", description="Add a new slide with a title and content to an existing presentation", inputSchema={ "type": "object", "properties": { "presentation_name": { "type": "string", "description": "Name of the presentation to add the slide to", }, "title": { "type": "string", "description": "Title of the slide", }, "content": { "type": "string", "description": "Content/body text of the slide. " "Separate main points with a single carriage return character." "Make sub-points with tab character." "Do not use bullet points, asterisks or dashes for points." "Max main points is 4" }, }, "required": ["presentation_name", "title", "content"], }, ),
  • Handler logic in @server.call_tool() that validates input arguments and delegates to PresentationManager.add_title_with_content_slide to add the slide.
    elif name == "add-slide-title-content": presentation_name = arguments.get("presentation_name") title = arguments.get("title") content = arguments.get("content") if not all([presentation_name, title, content]): raise ValueError("Missing required arguments") if presentation_name not in presentation_manager.presentations: raise ValueError(f"Presentation not found: {presentation_name}") try: slide = presentation_manager.add_title_with_content_slide(presentation_name, title, content) except Exception as e: raise ValueError(f"Unable to add slide '{title}' to presentation: {presentation_name}") return [ types.TextContent( type="text", text=f"Added slide '{title}' to presentation: {presentation_name}" ) ]
  • Core implementation in PresentationManager that creates a new slide using TITLE_AND_CONTENT layout (index 1), sets title, and formats content into bulleted list using _add_formatted_bullets.
    def add_title_with_content_slide(self, presentation_name: str, title: str, content: str) -> Slide: try: prs = self.presentations[presentation_name] except KeyError as e: raise ValueError(f"Presentation '{presentation_name}' not found") slide_master = prs.slide_master # Add a slide with title and content slide_layout = prs.slide_layouts[self.SLIDE_LAYOUT_TITLE_AND_CONTENT] # Use layout with title and content slide = prs.slides.add_slide(slide_layout) # Set the title title_shape = slide.shapes.title title_shape.text = title # Set the content content_shape = slide.placeholders[1] #content_shape.text = content # Get the content placeholder and add our formatted text text_frame = content_shape.text_frame self._add_formatted_bullets(text_frame, content) return slide
  • Helper method used to format the content into properly indented bullet points based on newlines and tabs.
    def _add_formatted_bullets(self, text_frame, text_block): """ Process a text block and add paragraphs with proper bullet indentation using ASCII code detection: - ASCII 10 (LF) or ASCII 13 (CR) or combination for new lines (main bullets) - ASCII 9 (HT) for tab indentation (sub-bullets) Args: text_frame: The PowerPoint text frame to add text to text_block: String of text to process """ # First, normalize all line endings to a single format # Replace CR+LF (Windows) with a single marker normalized_text = text_block.replace('\r\n', '\n') # Replace any remaining CR (old Mac) with LF normalized_text = normalized_text.replace('\r', '\n') # Split the text block into lines using ASCII 10 (LF) lines = normalized_text.split('\n') # Clear any existing text if text_frame.paragraphs: p = text_frame.paragraphs[0] p.text = "" else: p = text_frame.add_paragraph() # Process the first line separately (if it exists) if lines and lines[0].strip(): first_line = lines[0] # Count leading tabs (ASCII 9) to determine indentation level level = 0 while first_line and ord(first_line[0]) == 9: # ASCII 9 is HT (tab) level += 1 first_line = first_line[1:] p.text = first_line.strip() p.level = level # Process remaining lines for line in lines[1:]: if not line.strip(): continue # Skip empty lines # Count leading tabs (ASCII 9) to determine indentation level level = 0 while line and ord(line[0]) == 9: # ASCII 9 is HT (tab) level += 1 line = line[1:] # Add the paragraph with proper indentation p = text_frame.add_paragraph() p.text = line.strip() p.level = level def add_section_header_slide(self, presentation_name: str, header: str, subtitle: str):

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/supercurses/powerpoint'

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