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

Get Viewport Selection

selection_get
Read-only

Retrieve the entities pre-selected in the AutoCAD viewport to scope operations to the user's active selection instead of the entire drawing.

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

Annotations already declare readOnlyHint: true, but description adds significant behavioral details: returns pickfirst selection, specifies result keys, and describes fallback on headless backend. No contradictions.

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?

Well-structured with clear paragraphs, bullet points for result keys, and a code example. Efficient use of space with no redundant information.

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?

Fully covers purpose, usage, behavior, and output. Given the tool's simplicity and the presence of an output schema, the description is complete and self-contained.

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?

No parameters, so schema coverage is 100%. Description adds value by explaining the structure and meaning of the output, which is not covered by the input schema.

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?

Clearly states it reads pre-selected entities in AutoCAD viewport, with specific verb 'read' and resource 'entities'. Differentiates from sibling tools by being a reader, not a selection method.

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 describes when to use (to scope work to pre-selected entities) and includes a typical use code example. Also notes behavior differences between COM and ezdxf backends, providing comprehensive guidance.

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