Skip to main content
Glama

add_to_group

Add a node to a group in Godot .tscn scene files to organize and manage scene elements for game development workflows.

Instructions

Add a node to a group in a .tscn scene file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sceneYesPath to the .tscn file
nodePathYesNode path within the scene
groupYesGroup name to add
expectedHashNoExpected content hash for stale-edit prevention

Implementation Reference

  • The handler implementation for 'add_to_group', which reads the scene, validates the hash, ensures the node exists, checks if the group is already present, and updates the group list for the node.
    handler: async (ctx) => {
      const { scene: scenePath, nodePath, group, expectedHash } = ctx.args;
      validatePath(scenePath);
    
      return withFileLock(scenePath, async () => {
        try {
          const { source, scene } = await readAndParse(scenePath);
          const hashErr = hashCheck(source, expectedHash);
          if (hashErr) return makeTextResponse({ error: hashErr, data: null });
    
          const node = scene.nodes.get(nodePath);
          if (!node) {
            return makeTextResponse({
              error: `Node not found: ${nodePath}`,
              data: null,
            });
          }
    
          if (node.groups.includes(group)) {
            return makeTextResponse({
              error: `Node is already in group: ${group}`,
              data: null,
            });
          }
    
          node.groups.push(group);
    
          await writeAndEmit(scenePath, scene, eventBus, ctx.signal);
    
          return makeTextResponse({
            data: {
              nodePath,
              group,
              groups: node.groups,
            },
            metadata: { source: "index" },
          });
        } catch (err) {
          return makeTextResponse({
            error: `Failed to add to group: ${(err as Error).message}`,
            data: null,
          });
        }
      });
    },
  • The schema definition for 'add_to_group', including the required scene path, node path, and group name, with an optional expected hash.
    schema: {
      scene: z.string().describe("Path to the .tscn file"),
      nodePath: z.string().describe("Node path within the scene"),
      group: z.string().describe("Group name to add"),
      expectedHash: z
        .string()
        .optional()
        .describe("Expected content hash for stale-edit prevention"),
    },
  • The registration of the 'add_to_group' tool in the tools array.
    {
      name: "add_to_group",
      description: "Add a node to a group in a .tscn scene file.",
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Add a node to a group') but doesn't explain what this entails—whether it modifies the scene file permanently, requires specific permissions, has side effects on other nodes, or how it handles errors (e.g., if the node or group doesn't exist). For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, focused sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it efficient and easy to parse. Every part of the sentence earns its place by conveying essential information.

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

Completeness2/5

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

Given the tool's complexity (a mutation operation with 4 parameters) and the lack of annotations and output schema, the description is insufficient. It doesn't cover behavioral aspects like file modification, error handling, or return values, leaving the agent with incomplete context for safe and effective use. For a tool that alters scene files, more detail is needed to compensate for the missing structured data.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all four parameters (scene, nodePath, group, expectedHash) with clear descriptions. The description doesn't add any additional meaning beyond what's in the schema, such as explaining parameter interactions or usage examples. This meets the baseline of 3 when the schema handles parameter documentation adequately.

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

Purpose4/5

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

The description clearly states the action ('Add a node to a group') and the resource ('.tscn scene file'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'remove_from_group' or 'find_group_members', which would require mentioning it's specifically for adding rather than removing or querying group membership.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., the scene must exist), exclusions (e.g., cannot add to non-existent groups), or related tools like 'remove_from_group' for the inverse operation. It's a standalone statement with no contextual usage information.

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/woohq/godette-mcp'

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