MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / NewFunctionCall

Function NewFunctionCall

go/engine/node/functioncall.go:40–58  ·  view source on GitHub ↗

NewFunctionCall builds a FunctionCall. Validates that every declared return has a matching output binding.

(id string, fn *engine.Function, inputBindings map[string]workflow.Expression, outputBindings map[string]workflow.OutputBinding, toolDescription string)

Source from the content-addressed store, hash-verified

38// has a matching output binding.
39func NewFunctionCall(id string, fn *engine.Function, inputBindings map[string]workflowapi.Expression, outputBindings map[string]workflowapi.OutputBinding, toolDescription string) (*FunctionCall, error) {
40 for _, ret := range fn.Info.Returns {
41 if _, ok := outputBindings[ret.Uid]; !ok {
42 return nil, fmt.Errorf("function_call %s: missing output binding for return %s (uid %s)", id, ret.Name, ret.Uid)
43 }
44 }
45 for _, arg := range fn.Info.Arguments {
46 if _, ok := inputBindings[arg.Uid]; !ok {
47 return nil, fmt.Errorf("function_call %s: missing input binding for argument %s (uid %s)", id, arg.Name, arg.Uid)
48 }
49 }
50 return &FunctionCall{
51 LinearNode: engine.NewLinearNode(id),
52 fn: fn,
53 inputBindings: inputBindings,
54 outputBindings: outputBindings,
55 toolDescription: toolDescription,
56 }, nil
57}
58
59func (n *FunctionCall) Outputs() map[string]workflowapi.DataType {
60 raw := make(map[string]workflowapi.DataType, len(n.fn.Info.Returns))
61 for _, ret := range n.fn.Info.Returns {

Callers 3

TestNewFunctionCallFunction · 0.85
TestFunctionCall_OutputsFunction · 0.85
TestFunctionCall_ExecuteFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestNewFunctionCallFunction · 0.68
TestFunctionCall_OutputsFunction · 0.68
TestFunctionCall_ExecuteFunction · 0.68