The Core of YoMo Serverless LLM Function
description
stringArgument
type for input type definitionshandler()
function that contains your tool’s logicdescription
is a descriptive string to provide a clear, concise explanation of the tool’s functionality to the LLM.
example:
Argument
type defines the structure of the input data that your handler function expects. This TypeScript type is used by the framework to generate a the JSONSchema that the LLM can understand to format the arguments correctly.
Internally use typescript-json-schema to generate the JSONSchema from the TypeScript type.
example:
handler()
function is the core logic of your tool. This is the function that the LLM will call when it determines that your tool is needed.
Signature: Must be an async
function that accepts a single argument of the Argument
type and returns a Promise
that resolves to an object.
Return Value: The object returned by the handler()
will typically be formatted and presented back to the callee, which could be the LLM or MCP Client.
example:
test/
folder, for example test/app.test.ts
, and add the following code:
bun test
to execute the tests. The framework will automatically validate the types and ensure that your tools are functioning as expected.
You can use any testing framework you prefer, such as Jest or Mocha, to run your tests. The key is to ensure that your tests cover the functionality of your tools and validate the expected behavior.