MCPcopy Create free account
hub / github.com/BUPT-GAMMA/MASFactory / request_user_input

Method request_user_input

masfactory/visualizer/client.py:252–288  ·  view source on GitHub ↗

Request user input via the Visualizer UI. Args: node: Node name that initiated the request. prompt: Prompt text shown to the user. field: Optional field name associated with the prompt (for structured workflows). description: Optional extra de

(
        self,
        *,
        node: str,
        prompt: str,
        field: str | None = None,
        description: str | None = None,
        timeout_s: float | None = None,
        meta: dict[str, object] | None = None,
    )

Source from the content-addressed store, hash-verified

250 return
251
252 def request_user_input(
253 self,
254 *,
255 node: str,
256 prompt: str,
257 field: str | None = None,
258 description: str | None = None,
259 timeout_s: float | None = None,
260 meta: dict[str, object] | None = None,
261 ) -> str | None:
262 """Request user input via the Visualizer UI.
263
264 Args:
265 node: Node name that initiated the request.
266 prompt: Prompt text shown to the user.
267 field: Optional field name associated with the prompt (for structured workflows).
268 description: Optional extra description shown in the UI.
269 timeout_s: Optional timeout in seconds.
270 meta: Optional extra metadata attached to the request.
271
272 Returns:
273 User response string, or None if Visualizer is unavailable or the request times out.
274 """
275 try:
276 resp = self._runtime.request_interaction(
277 node=node,
278 prompt=prompt,
279 field=field,
280 description=description,
281 timeout_s=timeout_s,
282 meta=meta,
283 )
284 except Exception:
285 return None
286 if resp is None:
287 return None
288 return resp if isinstance(resp, str) else str(resp)
289
290 def open_file(self, options: VisualizerOpenFileOptions) -> bool:
291 """Open a file in VS Code and optionally reveal the Visualizer panel.

Callers 2

_forwardMethod · 0.80
_forwardMethod · 0.80

Calls 1

request_interactionMethod · 0.80

Tested by

no test coverage detected