# convert_to_watsonx_tool

> **Function** in `langchain_ibm`

📖 [View in docs](https://reference.langchain.com/python/langchain-ibm/agent_toolkits/utility/utils/convert_to_watsonx_tool)

Convert `WatsonxTool` to watsonx tool structure.

## Signature

```python
convert_to_watsonx_tool(
    tool: WatsonxTool,
) -> dict[str, Any]
```

## Description

???+ example "Example"

```python
from langchain_ibm.agents_toolkits.utility import WatsonxToolkit

watsonx_toolkit = WatsonxToolkit(
    url="https://us-south.ml.cloud.ibm.com",
    api_key="*****",
)
weather_tool = watsonx_toolkit.get_tool("Weather")
convert_to_watsonx_tool(weather_tool)
```

```json
{
    "type": "function",
    "function": {
        "name": "Weather",
        "description": "Find the weather for a city.",
        "parameters": {
            "type": "object",
            "properties": {
                "location": {
                    "title": "location",
                    "description": "Name of the location",
                    "type": "string",
                },
                "country": {
                    "title": "country",
                    "description": "Name of the state or country",
                    "type": "string",
                },
            },
            "required": ["location"],
        },
    },
}
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `tool` | `WatsonxTool` | Yes | `WatsonxTool` from `WatsonxToolkit` |

---

[View source on GitHub](https://github.com/langchain-ai/langchain-ibm/blob/68e9b09f8cbc8d2310e57a6a7eb51cde0956a3b0/libs/ibm/langchain_ibm/agent_toolkits/utility/utils.py#L10)