Skip to main content
Glama

Get Key Light Size

get_key_light_size

Retrieve the current key light area dimensions (width and height) to ensure accurate relative size adjustments in the 3D scene.

Instructions

Get the current key light area size (width and height in units). Query this before relative size 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:1262-1310 (registration)
    Registration of the 'get_key_light_size' tool via mcpServer.registerTool, including its input schema (empty), title 'Get Key Light Size', description, and handler function that queries state and returns the key light size (width and height).
    mcpServer.registerTool(
      'get_key_light_size',
      {
        title: 'Get Key Light Size',
        description: 'Get the current key light area size (width and height in units). ' +
          'Query this before relative size 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 size = state.keyLight?.size || { width: 1, height: 1 };
          const sizeText = `width ${size.width}, height ${size.height}`;
          
          return {
            content: [
              {
                type: 'text',
                text: formatStateResponse(sizeText, 'Key light size', sessionId, metadata)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error retrieving key light size: ${error.message}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • The handler function for 'get_key_light_size' - an async function that gets the current session ID, queries state using getState(sessionId), extracts state.keyLight?.size (defaulting to {width:1,height:1}), and returns a formatted response with the size information.
    mcpServer.registerTool(
      'get_key_light_size',
      {
        title: 'Get Key Light Size',
        description: 'Get the current key light area size (width and height in units). ' +
          'Query this before relative size 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 size = state.keyLight?.size || { width: 1, height: 1 };
          const sizeText = `width ${size.width}, height ${size.height}`;
          
          return {
            content: [
              {
                type: 'text',
                text: formatStateResponse(sizeText, 'Key light size', sessionId, metadata)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error retrieving key light size: ${error.message}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Input schema definition for 'get_key_light_size' - an empty object (inputSchema: {}) as this tool takes no input parameters. It only reads state.
    mcpServer.registerTool(
      'get_key_light_size',
      {
        title: 'Get Key Light Size',
        description: 'Get the current key light area size (width and height in units). ' +
          'Query this before relative size 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 size = state.keyLight?.size || { width: 1, height: 1 };
          const sizeText = `width ${size.width}, height ${size.height}`;
          
          return {
            content: [
              {
                type: 'text',
                text: formatStateResponse(sizeText, 'Key light size', sessionId, metadata)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error retrieving key light size: ${error.message}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Helper function queryFreshStateForManipulation used by relative adjustment tools (not directly by get_key_light_size but part of the same key light feature set).
    // Helper function to query fresh state before relative manipulations
    async function queryFreshStateForManipulation(sessionId) {
      try {
        const { state } = await getState(sessionId);
        return state;
      } catch (error) {
        console.warn(`Failed to query fresh state before manipulation: ${error.message}`);
        return null;
      }
    }
  • Helper function formatStateResponse used to format the state response with metadata (timestamp, source, staleness warning) for the get_key_light_size tool output.
    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})`;
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool returns width and height in units and is a read operation. It adds context about usage with cached state but does not detail any error conditions or additional behavioral traits.

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?

The description is two sentences with no wasted words. Critical information (purpose, units, usage hints) is front-loaded and efficient.

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?

Given that the tool has no parameters and no output schema, the description adequately covers what is needed. It explains the purpose and usage context. However, it could mention the return format explicitly (e.g., object fields) since there is no output schema.

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?

The input schema has zero parameters, so schema description coverage is 100%. The description adds no parameter information, which is acceptable as there are no parameters to describe.

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 it gets the current key light area size (width and height in units). It distinguishes from sibling getters for other properties (color, intensity, position) by specifying 'size'.

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

Usage Guidelines4/5

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

The description provides explicit guidance: query before relative size changes for accuracy, and for absolute changes, cached context is acceptable if no manual interactions occurred. It does not explicitly name alternative tools but implies context caching as an alternative.

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