Skip to content

Low Level Scripted Tools

Christian edited this page Sep 1, 2026 · 1 revision

Low Level Scripted Tools

Parts-database CRUD, the settings tree (get/set string/bool/int/double), PathMap variable substitution, arbitrary custom C# script execution, and the system message tree.

18 tools (all prefixed eplan_ when registered as MCP tools).

< Back to Home


eplan_parts_db_query

eplan_parts_db_query(filter_property: str=None, filter_value: str=None, return_properties: List[str]=None, limit: int=100)

Query parts from the EPLAN parts database.

Uses MDPartsManagement API for direct database access.

Args: filter_property: Property to filter on (e.g., "ProductSubGroup", "PartNr", "Manufacturer") filter_value: Value to match return_properties: List of properties to return (default: PartNr, Description1, Manufacturer) limit: Maximum number of parts to return

Returns: dict with parts list and count


eplan_parts_db_count

eplan_parts_db_count(filter_property: str=None, filter_value: str=None)

Count parts in the EPLAN parts database.

Args: filter_property: Property to filter on filter_value: Value to match

Returns: dict with count


eplan_parts_db_get_part

eplan_parts_db_get_part(part_number: str)

Get detailed information about a specific part.

Args: part_number: The part number to look up

Returns: dict with part details


eplan_parts_db_create

eplan_parts_db_create(part_number: str, properties: dict=None)

Create a new part in the parts database and optionally set properties.

Uses MDPartsDatabase.AddPart (verified in the P8 docs; throws if the part already exists — this function reports that as an error instead of silently updating; use parts_db_update for existing parts).

Args: part_number: Part number of the new part (must not exist yet) properties: Optional dict of raw parts-DB property names to string values, e.g. {"ARTICLE_MANUFACTURER": "Siemens", "ARTICLE_DESCR1": "Circuit breaker"}

Returns: dict with success status and the properties that were set


eplan_parts_db_update

eplan_parts_db_update(part_number: str, property_name: str, property_value: str)

Update a property on a part in the database.

Args: part_number: The part number to update property_name: Property to update (e.g., "ARTICLE_DESCR1") property_value: New value

Returns: dict with success status


eplan_parts_db_list_product_groups

eplan_parts_db_list_product_groups()

List all product groups and subgroups in the parts database.

Returns: dict with product groups


eplan_settings_get_string

eplan_settings_get_string(setting_path: str, index: int=0)

Get a string setting from EPLAN.

Args: setting_path: Full setting path (e.g., "USER.TrDMProject.UserData.Longname") index: Setting index (default 0)

Returns: dict with setting value


eplan_settings_set_string

eplan_settings_set_string(setting_path: str, value: str, index: int=0)

Set a string setting in EPLAN.

Args: setting_path: Full setting path value: Value to set index: Setting index (default 0)

Returns: dict with success status


eplan_settings_get_bool

eplan_settings_get_bool(setting_path: str, index: int=0)

Get a boolean setting from EPLAN.

Args: setting_path: Full setting path index: Setting index (default 0)

Returns: dict with setting value


eplan_settings_set_bool

eplan_settings_set_bool(setting_path: str, value: bool, index: int=0)

Set a boolean setting in EPLAN.

Args: setting_path: Full setting path value: Value to set index: Setting index (default 0)

Returns: dict with success status


eplan_settings_get_int

eplan_settings_get_int(setting_path: str, index: int=0)

Get an integer setting from EPLAN.

Args: setting_path: Full setting path index: Setting index (default 0)

Returns: dict with setting value


eplan_settings_set_int

eplan_settings_set_int(setting_path: str, value: int, index: int=0)

Set an integer setting in EPLAN.

Args: setting_path: Full setting path value: Value to set index: Setting index (default 0)

Returns: dict with success status


eplan_settings_get_double

eplan_settings_get_double(setting_path: str, index: int=0)

Get a double/float setting from EPLAN.

Args: setting_path: Full setting path index: Setting index (default 0)

Returns: dict with setting value


eplan_settings_set_double

eplan_settings_set_double(setting_path: str, value: float, index: int=0)

Set a double/float setting in EPLAN.

Args: setting_path: Full setting path value: Value to set index: Setting index (default 0)

Returns: dict with success status


eplan_pathmap_substitute

eplan_pathmap_substitute(path_with_variables: str)

Substitute EPLAN path variables in a string.

Args: path_with_variables: Path with EPLAN variables (e.g., "$(PROJECTPATH)")

Common variables: $(PROJECTPATH) - Current project path $(PROJECTNAME) - Current project name $(DOC) - Documents folder $(ELOGIN) - Current user login $(MD_MACROS) - Macros master data path $(MD_PARTS) - Parts master data path

Returns: dict with substituted path


eplan_pathmap_get_common_paths

eplan_pathmap_get_common_paths()

Get all common EPLAN path variables and their current values.

Returns: dict with path variables and values


eplan_execute_custom_script

eplan_execute_custom_script(script_code: str, timeout_seconds: float=30.0)

Execute a custom C# script in EPLAN.

The script should write results to a JSON file at the path specified by the {{RESULT_PATH}} placeholder.

Args: script_code: Complete C# script code with {{RESULT_PATH}} placeholder timeout_seconds: Max seconds to wait for the script to write its result file before giving up (default 30s). Raise this for scripts that walk large collections (e.g. every page/function in a big project).

Returns: dict with script results

Example script: using System; using System.IO; using System.Collections.Generic; using Eplan.EplApi.Scripting;

public class MyScript
{
    [Start]
    public void Run()
    {
        var results = new Dictionary<string, object>();
        results["success"] = true;
        results["message"] = "Hello from EPLAN!";

        string json = Newtonsoft.Json.JsonConvert.SerializeObject(results);
        File.WriteAllText(@"{{RESULT_PATH}}", json);
    }
}

eplan_get_system_messages

eplan_get_system_messages(min_level: str='Warning', max_messages: int=100)

Read EPLAN's system message tree - the same list the user sees in the GUI's system messages dialog.

Covers everything since EPLAN started (startup errors, add-in load problems, script compile errors, action warnings), not just messages from MCP-executed actions. The definitive way to answer "what errors is EPLAN showing?" without looking at the screen.

Args: min_level: Minimum severity: "Message" (everything), "Warning", "Error", or "FatalError". Default "Warning". max_messages: Return at most this many, keeping the NEWEST ones (default 100).

Each returned message is {"text", "level", "occurrences"}: "level" is the entry's own severity (BaseException.MessageLevel - not "Level", which does not exist and raises CS1061; verified live 2026-09-01) so a min_level="Message" call can still be filtered/grouped by severity client-side. "occurrences" is EPLAN's own count of consecutive identical messages joined into one tree item (see BaseException.NumberOfOccurrences)

  • usually 1, since consolidation depends on EPLAN's logging mode, not something this tool controls.

Clone this wiki locally