OptionaldescriptionDescription of the function.
For reference, the description is a critical property for teaching the
purpose of the function to LLMs (Large Language Models). LLMs use this
description to determine which function to call.
Also, when the LLM converses with the user, the description explains
the function to the user. Therefore, the description property has the
highest priority and should be carefully considered.
Representative name of the function.
Parameters of the function.
Validate function of the arguments.
You know what? LLM (Large Language Model) like OpenAI takes a lot of
mistakes when composing arguments in function calling. Even though number
like simple type is defined in the parameters schema, LLM often
fills it just by a string typed value.
In that case, you have to give a validation feedback to the LLM by using
this validate function. The validate function will return detailed
information about every type errors about the arguments.
And in my experience, OpenAI's gpt-4o-mini model tends to construct an
invalid function calling arguments at the first trial about 50% of the
time. However, if correct it through this validate function, the success
rate soars to 99% at the second trial, and I've never failed at the third
trial.
If you've separated parameters, use the IMcpLlmFunction.ISeparated.validate function instead when validating the LLM composed arguments.
In that case, This
validatefunction would be meaningful only when you've merged the LLM and human composed arguments by McpLlm.mergeParameters function.
Arguments to validate
Validation result
MCP LLM function.
IMcpLlmFunctionis an interface representing a function metadata of MCP (Model Context Protocol), which has been designed for the LLM (Language Large Model) function calling, instead of providingmcp_serversproperty to the LLM vendor API.It contains the target function's metadata name, parameters and description. You can put these properties to the LLM vendor API to let the LLM know the function's purpose and how to call it.
Also, it contains validate function, which is used to validate the function arguments generated by AI agent. It is very important to the LLM function calling, because LLM like OpenAI takes a lot of mistakes when composing arguments in function calling. Even though
numberlike simple type is defined in the parameters schema, LLM often fills it just by astringtyped value.Author
Jeongho Nam - https://github.com/samchon
Author
Byeongjin Oh - https://github.com/sunrabbit123