Skip to main content
Glama

list_slides

Retrieve all slides from a Google Slides presentation by providing the presentation ID to view and manage slide content.

Instructions

List all slides in a Google Slides presentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
presentationIdYesThe ID of the Google Slides presentation

Implementation Reference

  • The MCP server handler for the 'list_slides' tool. It calls the slidesService.listSlides method and formats the results into a text response listing all slides with their IDs and titles.
    private async handleListSlides(args: {
      presentationId: string;
    }): Promise<CallToolResult> {
      const slides = await this.slidesService.listSlides(args.presentationId);
    
      const slidesList = slides
        .map((slide) => `- ${slide.title} (ID: ${slide.slideId})`)
        .join('\n');
    
      return {
        content: [
          {
            type: 'text',
            text: `Slides in presentation:\n${slidesList}`,
          },
        ],
      };
    }
  • src/index.ts:125-137 (registration)
    Registration of the 'list_slides' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
      name: 'list_slides',
      description: 'List all slides in a Google Slides presentation',
      inputSchema: {
        type: 'object',
        properties: {
          presentationId: {
            type: 'string',
            description: 'The ID of the Google Slides presentation',
          },
        },
        required: ['presentationId'],
      },
    },
  • Input schema definition for the 'list_slides' tool, specifying the required 'presentationId' parameter.
    inputSchema: {
      type: 'object',
      properties: {
        presentationId: {
          type: 'string',
          description: 'The ID of the Google Slides presentation',
        },
      },
      required: ['presentationId'],
    },
  • Core helper method in GoogleSlidesService that fetches the presentation from Google Slides API, extracts slide information, and returns an array of SlideInfo objects.
    async listSlides(presentationId: string): Promise<SlideInfo[]> {
      await this.auth.refreshTokenIfNeeded();
      const slides = this.auth.getSlidesClient();
    
      try {
        const response = await slides.presentations.get({
          presentationId
        });
    
        return response.data.slides?.map((slide: any, index: number) => ({
          slideId: slide.objectId,
          title: `Slide ${index + 1}`
        })) || [];
      } catch (error) {
        console.error('Error listing slides:', error);
        throw new Error(`Failed to list slides: ${error}`);
      }
    }
  • Type definition for SlideInfo used as the return type for listSlides, defining slide ID and optional title.
    export interface SlideInfo {
      slideId: string;
      title?: string;
    }

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