list_themes
Lists all available tweakcn themes for shadcn UI components.
Instructions
List available tweakcn themes
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/tweakcn/list-themes.ts:9-48 (handler)The main handler function 'handleListThemes' that executes the tool logic - fetches themes from GitHub presets URL, filters by optional query, and returns results as JSON text.
export async function handleListThemes(args: z.infer<z.ZodObject<typeof schema>>) { try { const presets = await fetchPresetsFromGithub(DEFAULT_PRESETS_URL); let results = Object.entries(presets).map(([id, theme]) => ({ id, label: theme.label || theme.name || id, createdAt: theme.createdAt, // description: theme.description || "No description available", })); if (args.query) { const q = args.query.toLowerCase(); results = results.filter( (t) => t.id.toLowerCase().includes(q) || t.label.toLowerCase().includes(q) ); } return { content: [ { type: "text", text: JSON.stringify(results, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error listing themes: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } } - src/tools/tweakcn/list-themes.ts:5-7 (schema)Zod schema defining the input parameter 'query' (optional string) for filtering themes.
export const schema = { query: z.string().optional().describe("Search query to filter themes"), }; - src/tools/index.ts:9-31 (registration)Import and registration of list_themes handler/schema in the toolHandlers and toolSchemas maps.
import { handleListThemes, schema as listThemesSchema } from './tweakcn/list-themes.js'; import { handleGetTheme, schema as getThemeSchema } from './tweakcn/get-theme.js'; import { schema as getComponentSchema } from './components/get-component.js'; import { schema as getComponentDemoSchema } from './components/get-component-demo.js'; import { schema as listComponentsSchema } from './components/list-components.js'; import { schema as getComponentMetadataSchema } from './components/get-component-metadata.js'; import { schema as getDirectoryStructureSchema } from './repository/get-directory-structure.js'; import { schema as getBlockSchema } from './blocks/get-block.js'; import { schema as listBlocksSchema } from './blocks/list-blocks.js'; export const toolHandlers = { get_component: handleGetComponent, get_component_demo: handleGetComponentDemo, list_components: handleListComponents, get_component_metadata: handleGetComponentMetadata, get_directory_structure: handleGetDirectoryStructure, get_block: handleGetBlock, list_blocks: handleListBlocks, apply_theme: handleApplyTheme, list_themes: handleListThemes, get_theme: handleGetTheme }; - src/tools/index.ts:115-122 (registration)Tool definition with name, description ('List available tweakcn themes'), and inputSchema referencing listThemesSchema.
'list_themes': { name: 'list_themes', description: 'List available tweakcn themes', inputSchema: { type: 'object', properties: listThemesSchema } }, - src/server/handler.ts:265-276 (registration)Server tool registration in list of registered tools, with readOnlyHint annotation.
{ name: 'list_themes', description: 'List available tweakcn themes', inputSchema: { type: 'object', properties: {}, }, annotations: { title: "List Themes", readOnlyHint: true, }, },