Skip to main content
Glama

create_slide

Add a new slide to your Google Slides presentation by specifying the presentation ID and optional position for insertion.

Instructions

Create a new slide in a Google Slides presentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
insertionIndexNoPosition where to insert the slide (optional, defaults to 0)
presentationIdYesThe ID of the Google Slides presentation

Implementation Reference

  • Core handler implementing the create_slide tool logic: creates a new blank slide via Google Slides API batchUpdate.
    async createSlide(presentationId: string, insertionIndex?: number): Promise<SlideInfo> {
      await this.auth.refreshTokenIfNeeded();
      const slides = this.auth.getSlidesClient();
    
      const requests = [{
        createSlide: {
          objectId: `slide_${Date.now()}`,
          insertionIndex: insertionIndex || 0,
          slideLayoutReference: {
            predefinedLayout: 'BLANK'
          }
        }
      }];
    
      try {
        const response = await slides.presentations.batchUpdate({
          presentationId,
          requestBody: {
            requests
          }
        });
    
        const createdSlide = response.data.replies[0].createSlide;
        return {
          slideId: createdSlide.objectId,
          title: 'New Slide'
        };
      } catch (error) {
        console.error('Error creating slide:', error);
        throw new Error(`Failed to create slide: ${error}`);
      }
    }
  • MCP server handler for create_slide tool: delegates to slidesService.createSlide and formats response.
    private async handleCreateSlide(args: {
      presentationId: string;
      insertionIndex?: number;
    }): Promise<CallToolResult> {
      const slideInfo = await this.slidesService.createSlide(
        args.presentationId,
        args.insertionIndex
      );
    
      return {
        content: [
          {
            type: 'text',
            text: `Successfully created new slide with ID: ${slideInfo.slideId}`,
          },
        ],
      };
    }
  • src/index.ts:58-75 (registration)
    Tool registration in ListToolsRequestSchema handler, defining name, description, and input schema.
    {
      name: 'create_slide',
      description: 'Create a new slide in a Google Slides presentation',
      inputSchema: {
        type: 'object',
        properties: {
          presentationId: {
            type: 'string',
            description: 'The ID of the Google Slides presentation',
          },
          insertionIndex: {
            type: 'number',
            description: 'Position where to insert the slide (optional, defaults to 0)',
          },
        },
        required: ['presentationId'],
      },
    },
  • Type definition for the return value of createSlide (SlideInfo).
    export interface SlideInfo {
      slideId: string;
      title?: string;
    }
  • Dispatch case in CallToolRequestSchema handler for routing create_slide calls.
    case 'create_slide':
      return await this.handleCreateSlide(args as {
        presentationId: string;
        insertionIndex?: number;
      });

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/vamsikiran353-gif/google-slides-mcp'

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