powerdesigner-mcp

v0.1.2
powerdesigner-mcp Checked 3 days ago Published 2 months ago

MCP server that drives PowerDesigner 16.5 over COM: AI agents design CDM/LDM/PDM models, validate them and generate DDL

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_server_info

Check the PowerDesigner connection and report server capabilities. Call this first to verify PowerDesigner is reachable (or that the mock backend is active). Returns version, attach mode, open model count.

list_open_models

List all models currently open in PowerDesigner with kind (PDM/CDM/LDM), name, code, file path, DBMS and object counts.

open_model

Open a PowerDesigner model file (.pdm / .cdm / .ldm) and return its info. Set read_only=true to prevent modifications.

ParameterTypeDescription
path *string
read_onlyboolean

create_model

Create a new empty model. kind: 'PDM' | 'CDM' | 'LDM'. For PDM you may pass dbms (e.g. 'MySQL 5.0'); PowerDesigner picks its default when omitted. Returns the new model info including its model_id.

ParameterTypeDescription
kind *string
name *string
codestring
dbmsstring

save_model

Save a model to its current file. Fails with a clear error when the model was never saved (use save_model_as first).

ParameterTypeDescription
model_id *string

save_model_as

Save a model to a new file path (.pdm/.cdm/.ldm extension is appended automatically). The target file must not exist yet.

ParameterTypeDescription
model_id *string
path *string

close_model

Close a model in PowerDesigner. save=true saves to its file before closing.

ParameterTypeDescription
model_id *string
saveboolean

get_model_info

Get detailed info about one open model: kind, name, code, file, DBMS, and counts of tables/entities, columns, keys, references, indexes, domains.

ParameterTypeDescription
model_id *string

list_packages

List packages (sub-models/namespaces) of a model.

ParameterTypeDescription
model_id *string

get_package

Get details of one package by ref, code or name.

ParameterTypeDescription
model_id *string
package_ref *string

list_tables

List tables (PDM) or entities (CDM/LDM) of a model. Supports text search over code/name and optional package filter. Returns brief rows - use get_table for full detail.

ParameterTypeDescription
model_id *string
package_refstring
pageinteger
page_sizeinteger
querystring

get_table

Get full detail of one table/entity by ref or code: columns (type, length, mandatory, default, comment, primary), keys, primary key, indexes and incoming/outgoing references.

ParameterTypeDescription
model_id *string
table_ref *string

search_tables

Search tables by substring in code or name (case-insensitive).

ParameterTypeDescription
model_id *string
query *string
pageinteger
page_sizeinteger

list_columns

List the columns of a table (the attributes of a CDM/LDM entity) with full attributes. Optional text search.

ParameterTypeDescription
model_id *string
table_ref *string
querystring

get_column

Get one column's full detail.

ParameterTypeDescription
column_ref *string
model_id *string
table_ref *string

search_columns

Search columns across the whole model (or one table) by substring in code/name. Returns table_code + column detail rows.

ParameterTypeDescription
model_id *string
query *string
pageinteger
page_sizeinteger
table_refstring

list_keys

List keys of a table. The primary key has primary=true and its columns are included (supports single-column and composite keys).

ParameterTypeDescription
model_id *string
table_ref *string

get_key

Get one key by ref (from list_keys).

ParameterTypeDescription
key_ref *string
model_id *string
table_ref *string

list_indexes

List indexes of one table or of the whole model. Shows unique flag and covered columns (supports simple, unique and composite indexes).

ParameterTypeDescription
model_id *string
table_refstring

get_index

Get one index's full detail.

ParameterTypeDescription
index_ref *string
model_id *string
table_ref *string

list_references

List foreign-key references (PDM) of a model: parent/child tables, join column pairs, cardinality and mandatory flag.

ParameterTypeDescription
model_id *string

get_reference

Get one reference's full detail.

ParameterTypeDescription
model_id *string
reference_ref *string

list_relationships

List relationships of a CDM/LDM model (entity-to-entity relations). For PDM models use list_references instead.

ParameterTypeDescription
model_id *string

get_relationship

Get one CDM/LDM relationship by ref.

ParameterTypeDescription
model_id *string
relationship_ref *string

list_domains

List domains (reusable data type definitions) of a model.

ParameterTypeDescription
model_id *string

get_domain

Get one domain's detail.

ParameterTypeDescription
domain_ref *string
model_id *string

model_snapshot

Convert the model into compact JSON the AI can reason over. mode='summary': one line per table + references. mode='detail': full columns/keys/indexes/references. Optionally restrict to given table codes.

ParameterTypeDescription
model_id *string
modestring

inspect_schema

Inspect the whole schema at once. mode='summary'|'detail', optional single table, paginated. Returns tables + foreign keys view; use this instead of many list_* calls to save context.

ParameterTypeDescription
model_id *string
modestring
pageinteger
page_sizeinteger
tablestring

compare_model

Structurally compare two open models: added/removed/modified tables, added/removed/modified columns per table, references and domains.

ParameterTypeDescription
model_id_a *string
model_id_b *string

create_table

Create a table (PDM) or entity (CDM/LDM). Optionally pass an inline 'columns' array (same shape as create_column's column spec) to create columns in the same call. Supports dry_run.

ParameterTypeDescription
model_id *string
name *string
codestring
columns
commentstring
dry_runboolean

rename_table

Rename a table (Name and/or Code). Supports dry_run.

ParameterTypeDescription
model_id *string
table_ref *string
dry_runboolean
new_codestring
new_namestring

update_table

Update table properties: name, code, comment. Supports dry_run.

ParameterTypeDescription
model_id *string
table_ref *string
codestring
commentstring
dry_runboolean
namestring

delete_table

Delete a table (and PowerDesigner cascades its columns/keys/indexes and attached references). Destructive: prefer dry_run first.

ParameterTypeDescription
model_id *string
table_ref *string
dry_runboolean

create_column

Add a column to a table (an attribute, in CDM/LDM terms). Supported properties: name, code, data_type (e.g. 'VARCHAR', 'INT', 'DATETIME'), length, precision, mandatory, default_value, comment, description, domain (ref or code), primary (include in primary key). In a CDM/LDM the data type is rendered in PowerDesigner's own vocabulary ('Variable characters(20)') and 'primary' is ignored - primacy is set with create_primary_key. Supports dry_run.

ParameterTypeDescription
model_id *string
name *string
table_ref *string
codestring
commentstring
data_typestring
default_valuestring
domainstring
dry_runboolean
lengthinteger
mandatoryboolean
precisioninteger
primaryboolean

rename_column

Rename a column (Name and/or Code). Supports dry_run.

ParameterTypeDescription
column_ref *string
model_id *string
table_ref *string
dry_runboolean
new_codestring
new_namestring

update_column

Update column properties: name, code, data_type, length, precision, mandatory, default_value, comment, description, domain, primary. Only supplied values are changed. Supports dry_run.

ParameterTypeDescription
column_ref *string
model_id *string
table_ref *string
codestring
commentstring
data_typestring
default_valuestring
domainstring
dry_runboolean
lengthinteger
mandatoryboolean
namestring
precisioninteger
primaryboolean

delete_column

Delete a column from a table. Destructive: prefer dry_run first.

ParameterTypeDescription
column_ref *string
model_id *string
table_ref *string
dry_runboolean

create_primary_key

Create (or replace) the primary key of a table from the given column codes. Supports single-column and composite keys, e.g. columns=['order_id','product_id']. Existing PK membership is cleared. In a CDM/LDM this builds the entity's primary identifier (attributes carry no primary flag there) and points the entity at it. Supports dry_run.

ParameterTypeDescription
columns *array
model_id *string
table_ref *string
codestring
dry_runboolean
namestring

set_primary_key

Alias of create_primary_key: replaces the table's primary key with the given columns (composite supported).

ParameterTypeDescription
columns *array
model_id *string
table_ref *string
dry_runboolean
namestring

remove_primary_key

Remove the primary key from a table. Destructive: prefer dry_run first.

ParameterTypeDescription
model_id *string
table_ref *string
dry_runboolean

create_reference

Create an association between two objects. In a PDM this is a foreign-key reference (parent 1--N child); if parent_columns/child_columns are omitted the parent's primary key is used and FK columns are auto-created in the child (update_key=true, e.g. user 1--N order creates order.user_id). In a CDM/LDM it is a conceptual relationship between entities: parent_table/child_table name Entity1/Entity2, parent_columns/child_columns/update_key are ignored. cardinality = multiplicity at the child end ('0,n', '1,1', '1,n'; '0..*' also accepted); parent_cardinality = multiplicity at the parent end (defau…

ParameterTypeDescription
child_table *string
model_id *string
parent_table *string
cardinalitystring
child_columns
codestring
commentstring
dependent_rolestring
dry_runboolean
namestring
parent_cardinalitystring
parent_columns
update_keyboolean

update_reference

Update a reference: name, code, comment, mandatory, parent_role, child_role, cardinality ('0,n', '1,1', ...), parent_cardinality. In a CDM/LDM the cardinalities map onto the two role cardinalities and dependent_role ('A'/'B') marks the dependent side. Supports dry_run.

ParameterTypeDescription
model_id *string
reference_ref *string
cardinalitystring
child_rolestring
codestring
commentstring
dependent_rolestring
dry_runboolean
mandatoryboolean
namestring
parent_cardinalitystring
parent_rolestring

delete_reference

Delete a foreign-key reference (the FK columns in the child are kept). Destructive: prefer dry_run first.

ParameterTypeDescription
model_id *string
reference_ref *string
dry_runboolean

create_index

Create an index on a table: normal, unique or composite. Example: columns=['user_id','create_time'], name='idx_order_user_time'. PDM only - indexes are a physical concept and a CDM/LDM is rejected. Supports dry_run.

ParameterTypeDescription
columns *array
model_id *string
table_ref *string
commentstring
dry_runboolean
namestring
uniqueboolean

update_index

Update an index: name, unique flag, comment, or replace its columns. Supports dry_run.

ParameterTypeDescription
index_ref *string
model_id *string
table_ref *string
columns
commentstring
dry_runboolean
namestring
uniqueboolean

delete_index

Delete an index. Destructive: prefer dry_run first.

ParameterTypeDescription
index_ref *string
model_id *string
table_ref *string
dry_runboolean

create_database_schema

Create a whole schema in one call from a JSON spec: {tables:[{name, code, comment, columns:[{name, code, data_type, length, precision, mandatory, default_value, comment, primary}], indexes:[...]}], relationships:[{parent_table, child_table, parent_columns, child_columns, name, cardinality, parent_cardinality, dependent_role}], domains:[...], indexes:[...]}. Primary keys are derived from columns with primary:true (or primary_key_columns). The plan follows the target model's kind: in a CDM/LDM 'tables' are entities, columns are attributes rendered in PowerDesigner's own type vocabulary, primary…

ParameterTypeDescription
model_id *string
spec *object
atomicboolean
dry_runboolean

apply_schema_patch

Apply an ordered list of structured patch operations to a model. operations: [{op: create_table|alter_table|rename_table|drop_table|add_column|alter_column|drop_column|create_primary_key|drop_primary_key|create_reference|alter_reference|drop_reference|create_index|alter_index|drop_index|create_domain, ...}]. Execution stops at the first failure and (atomic, default) rolls back. dry_run=true returns the plan.

ParameterTypeDescription
model_id *string
operations *array
atomicboolean
dry_runboolean

design_from_spec

Materialise a full design spec into a NEW model (or extend an existing one via model_id). spec: {model:{kind: 'PDM'|'CDM'|'LDM', name, code, dbms}, tables/entities:[...], relationships:[...], domains:[...], indexes:[...]}. The AI supplies the design; this tool executes it. Supports dry_run.

ParameterTypeDescription
spec *object
atomicboolean
dry_runboolean
model_idstring

validate_model

Run built-in structural checks on a model: missing primary keys, duplicate table/column codes, missing data types, missing comments, FK type mismatches, dangling references, duplicate/redundant indexes. Returns passed/errors/warnings with object locations - fix issues and re-run to close the loop.

ParameterTypeDescription
model_id *string

check_database_design

Check a model against YOUR design rules. rules: [{id, description, type, params?, severity?}]. Machine-checkable types: TABLE_HAS_PK, TABLE_CODE_PATTERN, TABLE_NAME_STYLE, COLUMN_HAS_COMMENT, COLUMN_CODE_PATTERN, COLUMN_MANDATORY, REQUIRED_COLUMNS, PK_NAME_PATTERN, FK_NAME_PATTERN, INDEX_NAME_PATTERN, DATA_TYPE_ALLOWED, NO_DUPLICATE_INDEX, NO_EMPTY_COMMENT_TABLE, REGEX. Rules with unknown types are reported in 'skipped' (never silently ignored). Returns passed/errors/warnings/violations.

ParameterTypeDescription
model_id *string
rules *array

generate_ddl

Generate SQL DDL for a PDM using PowerDesigner's native database generation for the model's DBMS. output_path: target .sql file (created if the directory exists). Returns the SQL text plus file info. The model's own DBMS is used; requesting a different dbms returns a clear error.

ParameterTypeDescription
model_id *string
output_path *string
dbmsstring

convert_cdm_to_ldm

Convert a CDM model to an LDM. Uses PowerDesigner's native conversion when available, otherwise a structured mapping. Returns the new model info.

ParameterTypeDescription
model_id *string

convert_cdm_to_pdm

Convert a CDM model to a PDM (optionally pass dbms, e.g. 'MySQL 5.0'). Native conversion first, structured mapping as fallback.

ParameterTypeDescription
model_id *string
dbmsstring

convert_ldm_to_pdm

Convert an LDM model to a PDM (optionally pass dbms). Native conversion first, structured mapping as fallback.

ParameterTypeDescription
model_id *string
dbmsstring

begin_transaction

Start a transaction before a batch of modifications. For file-backed models the current file is saved and backed up so rollback can restore the exact pre-transaction state. Pass the returned txn_id to commit_transaction / rollback_transaction.

ParameterTypeDescription
model_id *string
auto_saveboolean

commit_transaction

Commit a transaction: keeps all changes and discards the backup.

ParameterTypeDescription
txn_id *string

rollback_transaction

Roll a transaction back: file-backed models are restored from the pre-transaction backup and reopened (the model_id may change - run list_open_models). Without a file backup, create/update operations are undone via the operation journal; deletions without backup cannot be undone and are reported explicitly.

ParameterTypeDescription
txn_id *string

list_model_backups

List available model backup files (created by transactions and save operations) in the backup directory.

rollback_model

Restore a model from a backup file (latest backup, or pass backup_file from list_model_backups). Closes the model, restores the file and reopens it.

ParameterTypeDescription
model_id *string
backup_filestring