Metadata-Version: 2.4
Name: meshagent-tools
Version: 0.1.0
Summary: Tools for Meshagent
License-Expression: Apache-2.0
Project-URL: Documentation, https://docs.meshagent.com
Project-URL: Website, https://www.meshagent.com
Project-URL: Source, https://www.meshagent.com
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyjwt~=2.10
Requires-Dist: pytest~=8.4
Requires-Dist: pytest-asyncio~=0.26
Requires-Dist: meshagent-api~=0.1
Requires-Dist: aiohttp~=3.10
Requires-Dist: opentelemetry-distro~=0.54b1
Dynamic: license-file

## MeshAgent Tools
The ``meshagent.tools`` package bundles reusable tool and toolkit abstractions plus a set of out of the box MeshAgent toolkits. 

### ToolContext and BaseTool
The ``ToolContext`` tracks the room, caller, and optional "on-behalf-of" participant. The ``BaseTool`` defines metadata used by all tools such as name and description. 

### Tool and Toolkit
A ``Tool`` encapsulates a single operation with an input JSON schema. Each tool implements an ``execute`` function where you define the logic for the tool. The ``Toolkit`` groups tools together and can enforce rules or descriptions.

### Response Types
Response types specify the output that a tool should return. This helps the tool and agent know how to handle the response appropriately. Response types include: ``JsonResponse``, ``TextResponse``, and ``FileResponse``.

```Python Python
from meshagent.tools import Tool, Toolkit, ToolContext
from meshagent.api.messaging import TextResponse

class MyNewTool(Tool):
    def __init__(self):
        super().__init__(
            name="my_new_tool",
            title="A sample tool", 
            description="The tool skeleton",
            input_schema={
                "type":"object",
                "additionalProperties": False,
                "required": [...],
                "properties": {...}
            }
        )
    async def execute(self, ctx:ToolContext, sample_parameter:str):
        # tool logic
        return TextResponse(text="Tool logic complete")
    
class MyNewToolkit(Toolkit):
    def __init__(self):
        super().__init__(
            name="my_new_toolkit", 
            title="An example toolkit", 
            description="The toolkit skeleton", 
            tools=[MyNewTool])


```

### Built-in Toolkits
Some of the built-in MeshAgent toolkits include: 
- ``StorageToolkit``: Provides file operations (read, write, list, etc.)
- ``DocumentAuthoringToolkit``: Defines tools for manipulating Mesh documents (create document, add element, remove element, etc.)

---
### Learn more about MeshAgent on our website or check out the docs for additional examples!

**Website**: [www.meshagent.com](https://www.meshagent.com/)

**Documentation**: [docs.meshagent.com](https://docs.meshagent.com/)

---
