Skip to content

loader

_loader

Utility for loading markdown prompt files with disk-read caching.

Layout of prompts/markdown/:

  • instructions/ -- what the server tells every client at connect time.
  • workflows/ -- one file per subject, named after the SideFX help scope it draws on, served by the MCP prompts.
  • shared/ -- fragments injected into the above, never served alone.

Callers pass the path relative to markdown/, e.g. workflows/pyro.md, so which of the three kinds a file is stays visible at every call site.

Functions:

Name Description
load_markdown

Load a markdown prompt file, optionally formatting placeholders.

markdown_exists

Whether a markdown prompt file ships under markdown/.

Functions:

load_markdown

load_markdown(name: str, **kwargs: str) -> str

Load a markdown prompt file, optionally formatting placeholders.

File contents are cached after the first read — the files never change at runtime, so this avoids repeated disk I/O on every prompt invocation.

Parameters:

Name Type Description Default
name
str

Path relative to the markdown/ directory, including the subdirectory, e.g. workflows/pyro.md.

required
**kwargs
str

Values to substitute into {placeholder} tokens in the markdown text. The special keys network_housekeeping and layout_guidance are automatically populated from shared/ if not explicitly provided.

{}

Returns:

Type Description
str

The formatted markdown string.

markdown_exists cached

markdown_exists(name: str) -> bool

Whether a markdown prompt file ships under markdown/.

Lets a prompt dispatch to a specialised file and fall back to a generic one, which is how simulation_setup serves a deep pyro guide without needing a separate MCP prompt per solver.