Skip to main content
Glama

Add Component

unity_add_component

Attach a component by type to a GameObject in Unity, using Undo for safe edits. Check existing components first to avoid duplicates.

Instructions

Add a component by type name to a GameObject. Uses Undo.

Example: {"path":"Player","component_type":"Rigidbody"}. Check unity_get_components first to avoid duplicates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesHierarchy path of the GameObject, e.g. 'Player' or 'Level/Enemies/Orc'
component_typeYesComponent type name, e.g. 'Rigidbody', 'BoxCollider', 'Light'

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare the safety profile (readOnlyHint=false, destructiveHint=false, idempotentHint=false). The description adds real behavioral context beyond them: 'Uses Undo' tells the agent the mutation is reversible, and the duplicate warning signals the operation is not self-deduplicating. It omits what happens on failure (e.g., component already present).

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

Conciseness4/5

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

Three short sentences, front-loaded with the action and followed by the undo note and a compact example. Slightly redundant since the example restates the schema's own field examples, but there is no padding or wasted prose.

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?

For a two-parameter mutation with annotations covering safety and an explicit undo note, the definition is nearly complete. The remaining gap is failure/return behavior on duplicate or invalid component types, which is not addressed despite the warning about duplicates.

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 both parameters are fully documented in the schema, and the inline example duplicates those field examples rather than extending them. Baseline 3 is appropriate; the example adds only marginal call-shape value.

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?

States a specific verb+resource+target: 'Add a component by type name to a GameObject.' An agent can distinguish it from the read-side sibling unity_get_components and from unity_attach_script, which the description implicitly excludes by scoping to generic component types.

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?

Gives an explicit precondition: 'Check unity_get_components first to avoid duplicates,' naming the sibling to consult. It does not clarify when to prefer this over unity_attach_script for script components, so it falls short of full when/when-not guidance.

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