summaryrefslogtreecommitdiff
path: root/examples/extensions/echo.lua
blob: 112ee25df2016ea036c4a0f141c9ba25fd0c1ce7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- A trivial Lua tool that echoes back whatever the LLM asks it to.
-- Useful for exercising the panto CLI's Lua extension path end-to-end.
--
-- Single-tool sugar form: return a table with a `handler` and panto
-- registers it as a tool. Its `name` is the identity gated by the
-- `[extensions]` allow/deny policy.

return {
    name = "echo",
    description = "Echo back the given message. Useful for testing whether tools work.",
    schema = {
        type = "object",
        properties = {
            message = {
                type = "string",
                description = "The text to echo back.",
            },
        },
        required = { "message" },
    },
    handler = function(input)
        return "echo: " .. input.message
    end,
}