Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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}`); } }
  • 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: {}, }, },
  • 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\`\`\``, }, ], }; }

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/GustavoGomezPG/basecoat-mcp'

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