INNER CODE UNIT · Python

validate_write_operation

nolabs-ai/deepfabric · tools-sdk/components/github/app.py:81

def validate_write_operation(tool_name: str) -> tuple[bool, str]:
    """Validate that write operations are allowed.

    Returns:
        (allowed, error_message)
    """
    write_tools = {"gh_add_issue_comment", "gh_create_issue", "gh_create_pr"}

    if tool_name not in write_tools:
        return True, ""

    if is_writes_allowed():
        return True, ""

    return False, f"Write operation '{tool_name}' is disabled. Set SPIN_VARIABLE_ALLOW_WRITES=true to enable."


# =============================================================================

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…