MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / tools_to_openai_format

Function tools_to_openai_format

src/harness/agentic_loop/tools.py:143–161  ·  view source on GitHub ↗

Merge orchestrator and MCP tools into OpenAI function-calling format.

(
    orchestrator_tools: list[OrchestratorTool],
    mcp_tools: list[dict[str, Any]],
)

Source from the content-addressed store, hash-verified

141
142
143def tools_to_openai_format(
144 orchestrator_tools: list[OrchestratorTool],
145 mcp_tools: list[dict[str, Any]],
146) -> list[dict[str, Any]]:
147 """Merge orchestrator and MCP tools into OpenAI function-calling format."""
148 combined = []
149 for tool in orchestrator_tools:
150 combined.append(
151 {
152 "type": "function",
153 "function": {
154 "name": tool.name,
155 "description": tool.description,
156 "parameters": tool.parameters,
157 },
158 }
159 )
160 combined.extend(mcp_tools)
161 return combined
162
163
164def build_plan_tools(

Callers 2

_setupMethod · 0.85
_run_plan_modeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected