Skip to main content
Glama

slides_generate

Generate presentation slides from text input using 2slides.com's API. Specify theme and language to create slides with job tracking for download.

Instructions

Generate slides with 2slides. Returns job info including jobId and downloadUrl when ready. Optional 'mode' can be 'sync' (default) or 'async'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
themeIdYes
userInputYes
responseLanguageYes
modeNo

Implementation Reference

  • Handler function that destructures args, makes a POST request to the 2slides API to generate slides, handles the response, and returns JSON data or error.
    async (args: any, _extra: any) => { const { themeId, userInput, responseLanguage, mode = 'sync' } = args as z.infer<z.ZodObject<typeof GenerateArgs>>; const url = `${API_BASE_URL}/api/v1/slides/generate`; const res = await fetch(url, { method: 'POST', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ themeId, userInput, responseLanguage, mode }), }); const data = await res.json(); if (!res.ok) { return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }], isError: true, }; } return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; }
  • Zod schema defining input parameters for the slides_generate tool: themeId, userInput, responseLanguage, and optional mode.
    const GenerateArgs = { themeId: z.string().min(1), userInput: z.string().min(1), responseLanguage: z.string().min(1), // Optional mode: 'sync' (default) | 'async' mode: z.enum(['sync', 'async']).optional(), };
  • src/server.ts:29-54 (registration)
    Registration of the slides_generate tool using mcp.tool, including name, description, schema, and handler.
    mcp.tool( 'slides_generate', "Generate slides with 2slides. Returns job info including jobId and downloadUrl when ready. Optional 'mode' can be 'sync' (default) or 'async'.", GenerateArgs, async (args: any, _extra: any) => { const { themeId, userInput, responseLanguage, mode = 'sync' } = args as z.infer<z.ZodObject<typeof GenerateArgs>>; const url = `${API_BASE_URL}/api/v1/slides/generate`; const res = await fetch(url, { method: 'POST', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ themeId, userInput, responseLanguage, mode }), }); const data = await res.json(); if (!res.ok) { return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }], isError: true, }; } return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; } );

Other Tools

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/2slides/mcp-2slides'

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