On this page
The character-preview MCP tools driving part selections, the weighted randomizer, and procedural oscillators through the validated authoritative document path.
#server.src.pixelweaver.mcp_character_tools
#server.src.pixelweaver.mcp_character_tools
Character-preview MCP tools -- drive the project-scoped character-preview subsystem (part selections, weighted randomizer, and procedural oscillators).
The character-preview document lives on ProjectState.character_preview and is validated as a whole against CharacterPreviewState on every write. Two arms:
- Granular setters wrap the schema-neutral character_ops functions (one per client preview_* / oscillator_* command). Each mutates the authoritative document through the validated path (set_character_preview), dispatches the matching client command for live WS clients, then broadcasts a full-state patch. Bad input raises inside character_ops and surfaces as a structured {"success": false} MCP error -- never a silent success.
- set_character_preview is the full-document setter: it validates and swaps the whole document (or clears it with null), covering any slice the granular tools do not -- notably deterministic randomize results (set a seed, then set the rolled document) which the client computes with crypto/roll semantics that are not portable to a headless setter.
All mutating handlers follow the established frame-tools sequence: validate -> mutate server state -> dispatch the frontend command -> broadcast.
#register_character_tools
def register_character_tools(registry: MCPCommandRegistry) -> NoneRegister all character-preview MCP tools.