tool_class.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. """
  2. -----------------------------------------------------------------------------------------
  3. INTERSEL - 4 cité d'Hauteville - 75010 PARIS
  4. RCS PARIS 488 379 660 - NAF 721Z
  5. File : tools/tool_class.py
  6. Object : Class for MCP server tools
  7. -----------------------------------------------------------------------------------------
  8. Modifications :
  9. - 2026/01/16 - Damien Lugagne-Delpon - V1.0.0- Creation
  10. -----------------------------------------------------------------------------------------
  11. @copyright : Intersel 2026
  12. @author : Damien Lugagne-Delpon - damien.lugagne-delpon@livinweb.fr
  13. @version : 1.0.0 (to be updated to the current_version of the developed software if file is touched)
  14. -----------------------------------------------------------------------------------------
  15. """
  16. class Tool:
  17. """Base class for MCP server tools."""
  18. def __init__(self, name: str, description: str = "", remarks: str = "", parameters: dict = {}, handler=None):
  19. """Initialize the tool."""
  20. self.name = name
  21. self.description = description
  22. self.remarks = remarks
  23. self.parameters = parameters
  24. self.handler = handler
  25. def translate_to_mcp(self):
  26. """Translate the tool to MCP format."""
  27. tool_dict = {
  28. "name": self.name,
  29. "description": self.description,
  30. "remarks": self.remarks,
  31. "parameters": self.parameters,
  32. }
  33. return tool_dict
  34. async def execute(self, **kwargs):
  35. pass