Documentation
¶
Overview ¶
Package openaitools renders existing go-codex tool/call declarations into the OpenAI "tools" array JSON shape used by Chat Completions/Responses API function calling (and by extension, most OpenAI-compatible providers and client frameworks such as LangChain that accept the same convention).
It is a pure renderer, the same category as render/openapi/ render/asyncapi/render/jsonschema/render/pipeline — no new declaration surface. FromMCPSpec and FromLLMSpec convert an EXISTING [mcp.MCPSpec]/llm.LLMSpec catalog (already accumulated by registering tools/calls against their respective Builders) into the OpenAI shape with zero additional declaration.
Usage ¶
mcpSpec, _ := mcpBuilder.MCPSpec() tools := openaitools.FromMCPSpec(mcpSpec) toolsJSON, err := openaitools.Render(tools) // toolsJSON is ready to embed directly in an OpenAI-style "tools" request field.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Tool ¶
type Tool struct {
Name string
Description string
Parameters json.RawMessage // JSON Schema
}
Tool is one entry in the OpenAI "tools" array.
func FromLLMSpec ¶
FromLLMSpec converts every declared llm.Call in spec into Tool entries, using each llm.CallSpec's RequestSchema as Parameters — lets one LLM-backed Call be exposed as a callable "tool" to a DIFFERENT orchestrating LLM (agent-calls-agent via the tool-calling convention, without needing a full Agent2Agent protocol implementation).
func FromMCPSpec ¶
FromMCPSpec converts every tool in spec into Tool entries, using each apimcp.ToolSpec's InputSchema as Parameters. Lets an application expose its EXISTING MCP tool declarations to a raw OpenAI-style tool-calling loop with zero additional declaration.