# Tool API

### Structure of Tool Query and Response

The `ToolQuery` class defines the structure for tool operation requests:

```python
class ToolQuery(Query):
    query_class: str = "tool"
    tool_calls: List[Dict[str, Union[str, Any]]]
    
    class Config:
        arbitrary_types_allowed = True
```

The `ToolResponse` class defines the structure for tool operation responses:

```python
class ToolResponse(Response):
    response_class: str = "tool"
    response_message: Optional[str] = None
    finished: bool = False
    error: Optional[str] = None
    status_code: int = 200
```

### Available Tool Management Commands

**List Hub Tools**

```bash
# View all tools available in the AIOS Tool Hub
list-toolhub-tools
```

**List Local Tools**

```bash
# View tools installed on your local system
list-local-tools
```

**Download a Tool**

```bash
# Get a specific tool from the AIOS Tool Hub
download-tool \
  --tool_author <author_name> \
  --tool_name <tool_name> \
  --tool_version <version_number> \
  --toolhub_url <hub_url>
```

**Upload a Tool**

```bash
# Share your custom tool with the AIOS community
upload-tool \
  --tool_path <path_to_tool_directory> \
  --toolhub_url <hub_url>
```

These commands help you discover, install, and share tools that extend AIOS functionality. Tools can provide specialized capabilities like data processing, external API access, and advanced computational features.
