Function: mcp--generate-tool-call-args
mcp--generate-tool-call-args is a natively compiled function defined
in mcp.el.
Signature
(mcp--generate-tool-call-args ARGS PROPERTIES)
Documentation
Generate tool call arguments from ARGS and PROPERTIES.
ARGS is a list of argument values provided by the caller. PROPERTIES is a plist of tool argument properties.
The function matches ARGS to PROPERTIES, filling in default values for missing optional arguments. It ensures the generated arguments match the tool's schema.
Returns a plist of argument names and values ready for tool invocation.
Source Code
;; Defined in /nix/store/5m747x13pb1ddrvbq9raj91c4q1h1kl0-emacs-packages-deps/share/emacs/site-lisp/elpa/mcp-20260615.940/mcp.el
(defun mcp--generate-tool-call-args (args properties)
"Generate tool call arguments from ARGS and PROPERTIES.
ARGS is a list of argument values provided by the caller.
PROPERTIES is a plist of tool argument properties.
The function matches ARGS to PROPERTIES, filling in default values for missing
optional arguments. It ensures the generated arguments match the tool's schema.
Returns a plist of argument names and values ready for tool invocation."
(let ((need-length (- (/ (length properties) 2)
(length args))))
(apply #'append
(cl-mapcar (lambda (arg value)
(when-let* ((value (if value
value
(plist-get (cl-second arg)
:default))))
(list (cl-first arg)
value)))
(seq-partition properties 2)
(append args
(when (> need-length 0)
(make-list need-length nil)))))))