MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _resolve_source

Function _resolve_source

src/tool_system/tools/workflow.py:70–87  ·  view source on GitHub ↗

Return ``(source, error)``.

(tool_input: dict, cwd: Optional[Path])

Source from the content-addressed store, hash-verified

68
69
70def _resolve_source(tool_input: dict, cwd: Optional[Path]) -> tuple[Optional[str], Optional[str]]:
71 """Return ``(source, error)``."""
72 script = tool_input.get("script")
73 if isinstance(script, str) and script.strip():
74 return script, None
75 script_path = tool_input.get("script_path")
76 if isinstance(script_path, str) and script_path.strip():
77 try:
78 return Path(script_path).read_text(encoding="utf-8"), None
79 except OSError as exc:
80 return None, f"could not read script_path: {exc}"
81 name = tool_input.get("name")
82 if isinstance(name, str) and name.strip():
83 source = resolve_named_workflow(name, cwd)
84 if source is None:
85 return None, f"no saved workflow named '{name}' under .claude/workflows"
86 return source, None
87 return None, "provide one of: script, script_path, or name"
88
89
90def _default_runner_factory(registry: Any, provider: Any) -> Callable[[ToolContext, str], Any]:

Callers 5

_callFunction · 0.85

Calls 2

resolve_named_workflowFunction · 0.85
getMethod · 0.45