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

Function build_tool

bmtools/tools/code_interpreter/api.py:27–47  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

25 self.locals = {}
26
27def build_tool(config) -> Tool:
28 tool = Tool(
29 "Python Code Interpreter Tool",
30 "Execute Python Codes",
31 name_for_model="code_interpreter",
32 description_for_model="Plugin for executing python codes",
33 logo_url=None,
34 contact_email=None,
35 legal_info_url=None
36 )
37
38 # Usage example
39 interpreter = CodeInterpreter()
40
41 @tool.get("/execute_code")
42 def execute_python_code(code: str):
43 '''execute Python expressions with Python Interpreter, can be used as a simple calculator e.g., "(123 + 234) / 23 * 19"
44 '''
45 return interpreter.execute_code(code)
46
47 return tool

Callers

nothing calls this directly

Calls 2

CodeInterpreterClass · 0.85
ToolClass · 0.50

Tested by

no test coverage detected