Add text features: trusted triggers, context cache, response policy, MCP config tools
This commit is contained in:
@@ -128,6 +128,51 @@ function buildServer(): McpServer {
|
||||
async () => jsonText(requirePuppet().getLog())
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
"get_context",
|
||||
{
|
||||
description:
|
||||
"Assemble recent conversation context for a channel. Fetches new messages incrementally by default.",
|
||||
inputSchema: {
|
||||
channelId: z.string().describe("Channel ID"),
|
||||
maxMessages: z.number().int().min(1).max(50).optional().describe("Message limit"),
|
||||
maxChars: z.number().int().min(200).max(20000).optional().describe("Character limit"),
|
||||
refresh: z.boolean().optional().describe("Fetch new messages first. Defaults to true.")
|
||||
}
|
||||
},
|
||||
async ({ channelId, maxMessages, maxChars, refresh }) =>
|
||||
jsonText(await requirePuppet().getContext(channelId, { maxMessages, maxChars, refresh }))
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
"get_puppet_config",
|
||||
{
|
||||
description: "Read the response policy and context settings."
|
||||
},
|
||||
async () => jsonText(requirePuppet().getConfig())
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
"set_puppet_config",
|
||||
{
|
||||
description: "Update the response policy and context settings. Sensitive commands reply by DM.",
|
||||
inputSchema: {
|
||||
config: z.object({
|
||||
contextMessages: z.number().int().min(1).max(50).optional(),
|
||||
contextChars: z.number().int().min(200).max(20000).optional(),
|
||||
responsePolicy: z
|
||||
.object({
|
||||
defaultMode: z.enum(["channel", "dm"]).optional(),
|
||||
sensitiveCommands: z.array(z.string()).optional(),
|
||||
overrides: z.record(z.string(), z.enum(["channel", "dm"])).optional()
|
||||
})
|
||||
.optional()
|
||||
})
|
||||
}
|
||||
},
|
||||
async ({ config }) => jsonText(requirePuppet().updateConfig(config))
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
"whitelist_list",
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user