Skip to main content
Glama
nezolder

Civil 3D MCP Server

by nezolder

civil3d_execute

Run C# code in Civil 3D with write access to modify drawings, executing inside a committed transaction and returning JSON results.

Instructions

Execute C# code in Civil 3D with write access. The code runs inside a committed transaction. Available globals: Document, CivilDoc, Database, Transaction, Editor. All Civil 3D namespaces are auto-imported. Return a value to get results back as JSON. Use this for operations that MODIFY the drawing (create, edit, delete objects). expectedDrawing must come from a prior read-only identity query. To persist the drawing file, set saveDrawing=true; do not call Database.SaveAs or queue QSAVE from the C# code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesC# code to execute. Has access to Document, CivilDoc, Database, Transaction, Editor. Example: var id = TinSurface.Create(Database, "MySurface"); return new { success = true };
descriptionNoOptional human-readable summary; excluded from operation audit logs.
saveDrawingNoWhen true, save the currently named DWG after the write transaction commits and wait for completion. Use this instead of Database.SaveAs or Document.SendStringToExecute("QSAVE") in code. An unsaved drawing must first be named in Civil 3D.
idempotencyKeyNoOptional opaque session key. Reuse it only to manually reconcile an uncertain outcome; use a new key for an intentional new write.
expectedDrawingYesExpected active drawing identity checked immediately before Civil API access.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.7/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well: it notes the committed transaction, available globals, JSON return, drawing identity check, and save workflow. It does not mention exception handling or failure rollback, but that is a minor gap for a code-execution tool.

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?

The description is compact and front-loaded with the core purpose, then elaborates on key parameters and constraints. It is not overly verbose, though bullet formatting could improve scannability; still, every sentence earns its place.

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?

For a complex code-execution tool with no output schema, the description explains available globals, return format, drawing identity requirements, save behavior, and sibling distinction. No critical operational detail is missing.

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

Parameters5/5

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

Schema coverage is 100%, yet the description adds significant context: expectedDrawing provenance and check timing, saveDrawing conditions (must be named), idempotencyKey purpose, and an example for code. It clearly enhances schema-only information.

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 states a precise purpose: executing C# code with write access in Civil 3D. It explicitly scopes the tool to modifying the drawing ('Use this for operations that MODIFY the drawing'), which distinguishes it from the read-only sibling civil3d_query.

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?

It provides clear usage criteria: use for modifications, not for reads; requires expectedDrawing from a prior civil3d_query; and warns against calling Database.SaveAs or queuing QSAVE, directing the user to the saveDrawing parameter instead. This fully covers when and how to use it versus alternatives.

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

Deploy Server

Other Tools