themes_search
Find presentation slide themes by entering search queries, with optional results limit to refine discovery.
Instructions
Search 2slides themes by query. Optional limit (max 100).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| limit | No |
Implementation Reference
- src/server.ts:85-105 (handler)Handler implementation for the 'themes_search' tool. Performs a GET request to the 2slides themes search API endpoint with query and optional limit parameters, returns JSON response or error.mcp.tool('themes_search', 'Search 2slides themes by query. Optional limit (max 100).', ThemesSearchArgs, async (args: any, _extra: any) => { const { query, limit } = args as z.infer<z.ZodObject<typeof ThemesSearchArgs>>; const search = new URLSearchParams({ query }); if (typeof limit === 'number') search.set('limit', String(limit)); const url = `${API_BASE_URL}/api/v1/themes/search?${search.toString()}`; const res = await fetch(url, { method: 'GET', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, }); 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) }] }; });
- src/server.ts:80-83 (schema)Zod schema defining input arguments for the 'themes_search' tool: required 'query' string and optional 'limit' number (1-100).const ThemesSearchArgs = { query: z.string().min(1), limit: z.number().int().positive().max(100).optional(), };
- src/server.ts:85-105 (registration)Registration of the 'themes_search' tool with MCP server, including description, schema, and inline handler function.mcp.tool('themes_search', 'Search 2slides themes by query. Optional limit (max 100).', ThemesSearchArgs, async (args: any, _extra: any) => { const { query, limit } = args as z.infer<z.ZodObject<typeof ThemesSearchArgs>>; const search = new URLSearchParams({ query }); if (typeof limit === 'number') search.set('limit', String(limit)); const url = `${API_BASE_URL}/api/v1/themes/search?${search.toString()}`; const res = await fetch(url, { method: 'GET', headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json', }, }); 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) }] }; });