Skip to main content
Glama
U-C4N
by U-C4N

Get Viewport Selection

selection_get
Read-only

Retrieve the currently selected entities in the AutoCAD viewport to scope operations to exactly what the user highlighted. Returns handles and entity details for the pickfirst selection.

Instructions

Read the entities the user pre-selected in the AutoCAD viewport (COM backend only).

Returns the implied "pickfirst" selection — the entities highlighted with grips before invoking the AI — so work can be scoped to exactly those entities instead of the whole drawing. Typical use::

sel = selection_get()
dimension_auto(sel["handles"], style="chain")

Result keys: ok — True on the COM backend (even for an empty selection) count — number of selected entities handles — list of entity handles (hex strings) to act on entities — full per-entity info (type, layer, color, ...) pickfirst — state of the PICKFIRST sysvar (None if unknown) message — guidance when nothing is selected

On the ezdxf headless backend there is no viewport, so this returns ok=False with an empty handles list.

fields / compact shape the "entities" collection — this tool already returns an object, so the columnar envelope lands under that key rather than replacing the result. handles is unaffected, so a caller that only wants handles can pass fields=["handle"] and still read handles directly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoProject to these fields, in this order (e.g. ['handle','type','layer']); 'properties.<key>' reaches one nested value. Omit for the full record; an unknown name errors and lists the valid ones.
compactNoReturn a columnar {fields, rows, count, offset, total, truncated, next_offset} envelope instead of dicts: much cheaper per row, and the only shape that reports truncation.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

Beyond the readOnlyHint annotation, the description adds substantial behavioral detail: COM-only behavior, ezdxf fallback with ok=False, the pickfirst sysvar state, return keys even for empty selections, and how fields/compact reshape the response. It also warns that unknown field names error.

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 well-structured: it front-loads the core purpose, then gives a usage example, a result-key list, backend caveats, and parameter behavior. Every sentence carries useful information without fluff, and the list format aids scanning.

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

Completeness5/5

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

With an output schema present, the description does not need to fully restate return values, but it still goes beyond by covering backend differences, sysvar state, error behavior, and parameter interactions. The tool is simple enough that this is fully complete.

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 already describes both parameters thoroughly (100% coverage), giving a baseline of 3. The description adds extra semantic value by explaining how fields/compact affect the 'entities' collection specifically (envelope lands under that key) and that 'handles' remains unaffected.

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 uses a specific verb ('Read') and resource ('entities the user pre-selected in the AutoCAD viewport'), clearly distinguishing this from sibling tools like selection_window that create selections. It also states the outcome: 'so work can be scoped to exactly those entities.'

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 clearly explains when to use the tool (when entities are pre-selected with grips) and provides a typical usage example. It also explicitly notes a when-not case: the ezdxf headless backend returns ok=False. However, it does not explicitly name an alternative sibling tool, so it falls short of a 5.

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/U-C4N/Autocad-MCP'

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