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
| Name | Required | Description | Default |
|---|---|---|---|
| presentationId | Yes | The ID of the Google Slides presentation |
Implementation Reference
- src/index.ts:304-321 (handler)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'], }, },
- src/index.ts:127-136 (schema)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'], },
- src/slides.ts:233-250 (helper)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}`); } }
- src/slides.ts:3-6 (schema)Type definition for SlideInfo used as the return type for listSlides, defining slide ID and optional title.export interface SlideInfo { slideId: string; title?: string; }