Skip to main content
Glama

Get Key Light Color

get_key_light_color

Retrieve the current key light color as a hex code. Use this before making relative color adjustments to maintain accuracy.

Instructions

Get the current key light color as a hex color code (e.g., "#ffffff"). Query this before relative color changes to ensure accuracy. For absolute changes, you may use recently queried state from context if no manual interactions occurred.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • server.js:1213-1260 (registration)
    Registration of the 'get_key_light_color' tool via mcpServer.registerTool
    mcpServer.registerTool(
      'get_key_light_color',
      {
        title: 'Get Key Light Color',
        description: 'Get the current key light color as a hex color code (e.g., "#ffffff"). ' +
          'Query this before relative color changes to ensure accuracy. ' +
          'For absolute changes, you may use recently queried state from context if no manual interactions occurred.',
        inputSchema: {}
      },
      async () => {
        const sessionId = getCurrentSessionId();
        if (!sessionId) {
          return {
            content: [
              {
                type: 'text',
                text: 'Error: No active session found.'
              }
            ],
            isError: true
          };
        }
    
        try {
          const { state, metadata } = await getState(sessionId);
          const color = state.keyLight?.color || '#ffffff';
          
          return {
            content: [
              {
                type: 'text',
                text: formatStateResponse(color, 'Key light color', sessionId, metadata)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error retrieving key light color: ${error.message}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Handler function for the 'get_key_light_color' tool. Gets the current key light color from browser state (state.keyLight?.color) and returns it as a hex color code.
      async () => {
        const sessionId = getCurrentSessionId();
        if (!sessionId) {
          return {
            content: [
              {
                type: 'text',
                text: 'Error: No active session found.'
              }
            ],
            isError: true
          };
        }
    
        try {
          const { state, metadata } = await getState(sessionId);
          const color = state.keyLight?.color || '#ffffff';
          
          return {
            content: [
              {
                type: 'text',
                text: formatStateResponse(color, 'Key light color', sessionId, metadata)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error retrieving key light color: ${error.message}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Input schema for 'get_key_light_color' tool - empty object (no input parameters needed)
    'get_key_light_color',
    {
      title: 'Get Key Light Color',
      description: 'Get the current key light color as a hex color code (e.g., "#ffffff"). ' +
        'Query this before relative color changes to ensure accuracy. ' +
        'For absolute changes, you may use recently queried state from context if no manual interactions occurred.',
      inputSchema: {}
    },
  • formatStateResponse helper function used by the handler to format the response with metadata.
    function formatStateResponse(value, propertyName, sessionId, metadata) {
      const timestamp = metadata.timestamp;
      const source = metadata.source;
      const stalenessWarning = metadata.wasCached 
        ? ' (using cached state - browser may be disconnected)' 
        : '';
      
      return `${propertyName}: ${value} (queried at ${timestamp}, source: ${source}${stalenessWarning})`;
    }
  • getState helper function used by the handler to fetch current state from the browser (with cache fallback).
    async function getState(sessionId) {
      let state;
      let source;
      let wasCached = false;
      
      // Always query browser for current state
      try {
        state = await queryStateFromBrowser(sessionId);
        source = 'fresh';
      } catch (error) {
        // If query fails, fall back to cache if available (browser may be disconnected)
        const cached = sessionStateCache.get(sessionId);
        if (cached) {
          console.warn(`Browser query failed for session ${sessionId}, returning cached state: ${error.message}`);
          state = cached.state;
          source = 'cache';
          wasCached = true;
        } else {
          // No cache available, throw error
          throw new Error(`Unable to retrieve state: ${error.message}. Browser may be disconnected.`);
        }
      }
      
      // Return state with metadata
      return {
        state,
        metadata: {
          source,
          wasCached,
          timestamp: new Date().toISOString()
        }
      };
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description discloses the return format and hints at behavioral context (accuracy for relative changes), but could mention if the tool is purely read-only.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no redundant words, perfectly front-loaded with the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequately covers all necessary information for a parameterless getter; could potentially mention what happens if key light is not set, but not required.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Since the input schema has no parameters, baseline is 4; the description adds value by explaining the return format and usage tips.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves the current key light color as a hex color code, distinguishing it from sibling getters and setters.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly advises querying before relative color changes and notes that for absolute changes, recently queried state may be used, providing clear guidance on when to use the tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/aidenlab/hello3dmcp-server'

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