get_theme_script
Retrieve JavaScript code to implement dark/light mode theme switching for web interfaces using Basecoat UI components.
Instructions
Get theme switcher script for dark/light mode
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:118-126 (handler)Core handler function that reads the theme script HTML from 'scripts/theme-script.html' and returns its trimmed content.async getThemeScript() { const themePath = path.join(__dirname, 'scripts', 'theme-script.html'); try { const content = await fs.readFile(themePath, 'utf-8'); return content.trim(); } catch (error) { throw new Error(`Failed to read theme script: ${error.message}`); } }
- server.js:216-219 (schema)Input schema for the 'get_theme_script' tool, which takes no parameters.inputSchema: { type: 'object', properties: {}, },
- server.js:213-220 (registration)Tool registration in the ListTools response, including name, description, and schema.{ name: 'get_theme_script', description: 'Get theme switcher script for dark/light mode', inputSchema: { type: 'object', properties: {}, }, },
- server.js:317-327 (handler)Dispatch handler in the CallToolRequestSchema switch that calls getThemeScript and formats the response as markdown.case 'get_theme_script': { const themeScript = await this.getThemeScript(); return { content: [ { type: 'text', text: `# Theme Switcher\n\nAdd this to enable dark/light mode switching:\n\n\`\`\`html\n${themeScript}\n\`\`\``, }, ], }; }