# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aios.foundation/aios-docs/aios-agent-sdk/tool-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
