Skip to main content
Glama
Jpisnice
by Jpisnice
get-theme.ts1.49 kB
import { z } from "zod"; import fetchPresetsFromGithub from "./fetch-presets.js"; import { DEFAULT_PRESETS_URL } from "./orchestrator.js"; export const schema = { themeName: z.string().describe("Name or ID of the theme to retrieve"), }; export async function handleGetTheme(args: z.infer<z.ZodObject<typeof schema>>) { try { const presets = await fetchPresetsFromGithub(DEFAULT_PRESETS_URL); const themeId = args.themeName; // Direct match if (presets[themeId]) { return { content: [ { type: "text", text: JSON.stringify(presets[themeId], null, 2), }, ], }; } // Search by label if ID not found const foundId = Object.keys(presets).find( (id) => (presets[id].label && presets[id].label.toLowerCase() === themeId.toLowerCase()) || id.toLowerCase() === themeId.toLowerCase() ); if (foundId) { return { content: [ { type: "text", text: JSON.stringify(presets[foundId], null, 2), }, ], }; } return { content: [ { type: "text", text: `Theme not found: ${themeId}`, }, ], isError: true, }; } catch (error) { return { content: [ { type: "text", text: `Error getting theme: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }

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/Jpisnice/shadcn-ui-mcp-server'

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