> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mcp-use.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Display

> Display API Documentation

export const RandomGradientBackground = ({className, color, children, grayscaled = false}) => {
  const values = color ? color.split("(")[1].split(")")[0].trim().split(/\s+/) : [];
  const saturation = color ? parseFloat(values[1] || "0") : grayscaled ? 0 : 0.2;
  const lightness = color ? parseFloat(values[0] || "0.5") : grayscaled ? 0.3 : 0.4;
  const randomHue = color ? parseFloat(values[2] || "0") : Math.floor(Math.random() * 360);
  const randomColor = color || `oklch(${Math.min(lightness, 1)} ${saturation} ${randomHue})`;
  const lightColor = `oklch(${Math.min(lightness * 2, 1)} ${saturation} ${randomHue})`;
  const direction = Math.floor(Math.random() * 360);
  const brightnessFilter = "1000%";
  return <div className={`relative overflow-hidden ${className || ""}`} style={{
    background: `${lightColor}`,
    minHeight: '100%',
    width: '100%'
  }}>
      <div className="absolute inset-0 w-full h-full" style={{
    background: `linear-gradient(${direction}deg, ${randomColor}, transparent), url(https://grainy-gradients.vercel.app/noise.svg)`,
    filter: `contrast(120%) brightness(${brightnessFilter})`,
    backgroundSize: 'cover',
    backgroundRepeat: 'no-repeat'
  }} />
      {children && <div className="relative z-10 w-full h-full">{children}</div>}
    </div>;
};

<Callout type="info" title="Source Code">
  View the source code for this module on GitHub: <a href="https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp_use/agents/display.py" target="_blank" rel="noopener noreferrer">[https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp\_use/agents/display.py](https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp_use/agents/display.py)</a>
</Callout>

## log\_agent\_step

<Card type="info">
  ### `function` log\_agent\_step

  Display or log an agent step based on pretty\_print flag.

  ```python theme={null}
  from mcp_use.agents.display import log_agent_step
  ```

  **Parameters**

  > <ParamField body="item" required="True">   Parameter value </ParamField>
  > <ParamField body="pretty_print" default="True">   Parameter value </ParamField>

  **Signature**

  ```python wrap theme={null}
  def log_agent_step(item, pretty_print = True):
  ```
</Card>

## log\_agent\_stream

<Card type="info">
  ### `function` log\_agent\_stream

  Handle streaming events from astream\_events.

  ```python theme={null}
  from mcp_use.agents.display import log_agent_stream
  ```

  **Parameters**

  > <ParamField body="chunk" required="True">   Event dictionary from LangChain's astream\_events </ParamField>
  > <ParamField body="pretty_print" default="True">   If True, use rich formatting. If False, do nothing. </ParamField>

  **Signature**

  ```python wrap theme={null}
  def log_agent_stream(chunk, pretty_print = True):
  ```
</Card>
