midas-backend / base_tool.py
Midas Deploy Bot
Deploy: 8c89a8fbe906551039281c5c5a0089572c945b0b
9419f40
raw
history blame contribute delete
914 Bytes
from abc import ABC, abstractmethod
from typing import List, Dict, Any
class BaseTool(ABC):
"""
The universal contract for any capability.
Enforces structure so the Agent Loader can handle any tool automatically.
"""
@property
@abstractmethod
def name(self) -> str:
"""Unique identifier (e.g., 'get_stock_price')."""
pass
@property
@abstractmethod
def description(self) -> str:
"""Natural language instruction for the LLM."""
pass
@property
@abstractmethod
def categories(self) -> List[str]:
"""Tags for the Registry (e.g., ['finance', 'public_api'])."""
pass
@abstractmethod
def get_schema(self) -> Dict[str, Any]:
"""Returns the JSON schema for LLM function calling."""
pass
@abstractmethod
def run(self, **kwargs) -> Any:
"""Executes the tool logic."""
pass