MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / read_file

Function read_file

bmtools/tools/file_operation/api.py:32–43  ·  view source on GitHub ↗

read file from disk

(file_path: str)

Source from the content-addressed store, hash-verified

30
31 @tool.get("/read_file")
32 def read_file(file_path: str) -> str:
33 '''read file from disk
34 '''
35 read_path = (
36 Path(file_path)
37 )
38 try:
39 with read_path.open("r", encoding="utf-8") as f:
40 content = f.read()
41 return content
42 except Exception as e:
43 return "Error: " + str(e)
44
45 return tool

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected