Skip to main content
Glama

add-slide-title-with-table

Add a slide with a title and table to a PowerPoint presentation by specifying the presentation name, slide title, and table data. Simplifies data organization and presentation creation process.

Instructions

Add a new slide with a title and table containing the provided data

Input Schema

NameRequiredDescriptionDefault
dataYesTable data object with headers and rows
presentation_nameYesName of the presentation to add the slide to
titleYesTitle of the slide

Input Schema (JSON Schema)

{ "properties": { "data": { "description": "Table data object with headers and rows", "properties": { "headers": { "description": "Array of column headers", "items": { "type": "string" }, "type": "array" }, "rows": { "description": "Array of row data arrays", "items": { "items": { "type": [ "string", "number" ] }, "type": "array" }, "type": "array" } }, "required": [ "headers", "rows" ], "type": "object" }, "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", "data" ], "type": "object" }

Implementation Reference

  • Core implementation of the tool logic: adds a title slide and inserts a table with styled headers and data rows using the python-pptx library.
    def add_table_slide(self, presentation_name: str, title: str, headers: str, rows: str) -> Slide: try: prs = self.presentations[presentation_name] except KeyError as e: raise ValueError(f"Presentation '{presentation_name}' not found") slide_layout = prs.slide_layouts[self.SLIDE_LAYOUT_TITLE_ONLY] slide = prs.slides.add_slide(slide_layout) # Set the title title_shape = slide.shapes.title title_shape.text = title # Calculate table dimensions and position num_rows = len(rows) + 1 # +1 for header row num_cols = len(headers) # Position table in the middle of the slide with some margins x = Inches(1) # Left margin y = Inches(2) # Top margin below title # Make table width proportional to the number of columns width_per_col = Inches(8 / num_cols) # Divide available width (8 inches) by number of columns height_per_row = Inches(0.4) # Standard height per row # Create table shape = slide.shapes.add_table( num_rows, num_cols, x, y, width_per_col * num_cols, height_per_row * num_rows ) table = shape.table # Add headers for col_idx, header in enumerate(headers): cell = table.cell(0, col_idx) cell.text = str(header) # Style header row paragraph = cell.text_frame.paragraphs[0] paragraph.font.bold = True paragraph.font.size = Pt(11) # Add data rows for row_idx, row_data in enumerate(rows, start=1): for col_idx, cell_value in enumerate(row_data): cell = table.cell(row_idx, col_idx) cell.text = str(cell_value) # Style data cells paragraph = cell.text_frame.paragraphs[0] paragraph.font.size = Pt(10) return slide
  • MCP tool dispatch handler: validates input arguments, checks presentation exists, validates table data structure, and delegates to PresentationManager.add_table_slide.
    elif name == "add-slide-title-with-table": presentation_name = arguments.get("presentation_name") title = arguments.get("title") table_data = arguments.get("data") if not all([presentation_name, title, table_data]): raise ValueError("Missing required arguments") if presentation_name not in presentation_manager.presentations: raise ValueError(f"Presentation not found: {presentation_name}") # Validate table data structure headers = table_data.get("headers", []) rows = table_data.get("rows", []) if not headers: raise ValueError("Table headers are required") if not rows: raise ValueError("Table rows are required") # Validate that all rows match header length if not all(len(row) == len(headers) for row in rows): raise ValueError("All rows must have the same number of columns as headers") try: slide = presentation_manager.add_table_slide(presentation_name, title, headers, rows) except Exception as e: raise ValueError(f"Unable to add slide '{title}' with a table to presentation: {presentation_name}") return [ types.TextContent( type="text", text=f"Added slide '{title}' with a table to presentation: {presentation_name}" ) ]
  • Tool registration in MCP server's list_tools() method, including name, description, and detailed input schema for table data.
    types.Tool( name="add-slide-title-with-table", description="Add a new slide with a title and table containing the provided data", 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", }, "data": { "type": "object", "description": "Table data object with headers and rows", "properties": { "headers": { "type": "array", "items": {"type": "string"}, "description": "Array of column headers" }, "rows": { "type": "array", "items": { "type": "array", "items": {"type": ["string", "number"]}, }, "description": "Array of row data arrays" } }, "required": ["headers", "rows"] } }, "required": ["presentation_name", "title", "data"], }, ),
  • Input schema definition specifying structure for presentation_name, title, and nested data object with headers (array of strings) and rows (array of arrays).
    types.Tool( name="add-slide-title-with-table", description="Add a new slide with a title and table containing the provided data", 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", }, "data": { "type": "object", "description": "Table data object with headers and rows", "properties": { "headers": { "type": "array", "items": {"type": "string"}, "description": "Array of column headers" }, "rows": { "type": "array", "items": { "type": "array", "items": {"type": ["string", "number"]}, }, "description": "Array of row data arrays" } }, "required": ["headers", "rows"] } }, "required": ["presentation_name", "title", "data"], }, ),

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/Ichigo3766/powerpoint-mcp'

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