Open EPM ← Back to openepm.dev

Register a Python builder

Replace the placeholders with values from your own authorized scope before copying this prompt into an MCP client.

Inputs

  • {{workspace_id}} Stable workspace ID.
  • {{application_id}} Stable application ID.
  • {{program_id}} Stable builder ID.
  • {{version}} Exact source version.
  • {{source_text}} Reviewed builder source.
  • {{entry_point}} Function name in the reviewed source.
  • {{parameter_schema}} Declared typed parameter schema.
  • {{environment_id}} Approved environment ID.
  • {{environment_version}} Exact approved environment version.
  • {{request_key}} Stable save key.

Prompt

For {{workspace_id}} / {{application_id}}, have an application administrator confirm the active environment {{environment_id}} version {{environment_version}} with python.environment.read.
Read application.state.read and pass its current metadataRevision, policyRevision, and schemaEpoch as expectedMetadataRevision, expectedPolicyRevision, and expectedSchemaEpoch.
Call execute_v2_python_program_registry with python.program.save, programId {{program_id}}, version {{version}}, sourceText {{source_text}}, entryPoint {{entry_point}}, parameterSchema {{parameter_schema}}, environmentId {{environment_id}}, environmentVersion {{environment_version}}, and idempotency_key {{request_key}}.
Use python.program.read with programId and version. Compare the sourceDigest and confirm the version is Saved. Poll the returned validation build/task until sealed or failed. If diagnostics are returned, use their source ranges and expected types to correct the source and save a new version. A saved row with pending or failed validation is not runnable.
Stop before publication or execution and report validation or authority failure.

Example inputs

Use a disposable application containing Budget, a Cash Flow account hierarchy and a Europe entity hierarchy. The sample selects existing numeric facts at their full coordinates, then doubles them. Missing cells and text cells are untouched; other dimensions remain unrestricted. Test first and inspect the complete selection. Set entryPoint to build and use the exact environment your deployment administrator approved. The embedded Python editor or an MCP client supplies source. Save automatically starts validation; inspect the returned diagnostics before testing or activating the version. The registered environment and current permissions govern execution.

from openepm import Ratio

def build(context, parameters):
    app = context.app
    selected = app.cube.select(
        app.dimension("Scenario").member("Budget"),
        app.dimension("Account").descendants("Cash Flow"),
        app.dimension("Entity").descendants("Europe"),
    )
    return selected.set(selected.value * Ratio("2"), name="double-europe-cash-flow")

Use this parameter schema with an empty parameter object.

{"type":"object","additionalProperties":false}

Tools used include read_v2_program, execute_v2_python_program_registry. See the module guidelines and tool index.

Discussion

Discussing Register a Python builder

The discussion service requires JavaScript and a connection to Firebase.