get_resource.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. """
  2. -----------------------------------------------------------------------------------------
  3. INTERSEL - 4 cité d'Hauteville - 75010 PARIS
  4. RCS PARIS 488 379 660 - NAF 721Z
  5. File : tools/resource/get_resource.py
  6. Object : Tool to get resources for the MCP server
  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. from mcp_server.tools.resource import ResourceTool
  17. def get_resource_tool():
  18. """Create and return the Get Resource tool."""
  19. parameters = {
  20. "id": {
  21. "type": "string",
  22. "description": "ID of the resource to retrieve",
  23. "required": True,
  24. "default": None
  25. },
  26. "mandatoryParents": {
  27. "type": "integer",
  28. "description": "An authorized parent for the given id",
  29. "required": False,
  30. "default": None
  31. }
  32. }
  33. tool = ResourceTool(
  34. name="Get Resource",
  35. description="Retrieve a resource by its ID.",
  36. remarks="",
  37. parameters=parameters,
  38. handler=get_resource_tool_handler
  39. )
  40. return tool
  41. async def get_resource_tool_handler(resource_id):
  42. """Handler function to get the resource."""
  43. pass