Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/tools/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ interface TemplateTypeConfig {
updateMethodName: keyof IterableClient;
proofMethodName: keyof IterableClient;
previewMethodName?: keyof IterableClient; // Only email and inapp support preview
// Special handling for parameter differences
getParamsTransform?: (params: z.infer<typeof GetTemplateParamsSchema>) => any;
}

const TEMPLATE_TYPES: TemplateTypeConfig[] = [
Expand All @@ -50,7 +48,6 @@ const TEMPLATE_TYPES: TemplateTypeConfig[] = [
updateMethodName: "updateEmailTemplate",
proofMethodName: "sendEmailTemplateProof",
previewMethodName: "previewEmailTemplate",
getParamsTransform: (params) => params.templateId, // Email uses just templateId
},
{
type: "sms",
Expand Down Expand Up @@ -94,12 +91,7 @@ function createTemplateToolsForType(
name: `get_${config.type}_template`,
description: `Get details for specific ${config.displayName} template by ID`,
schema: GetTemplateParamsSchema,
execute: (params) => {
const methodParams = config.getParamsTransform
? config.getParamsTransform(params)
: params;
return (client as any)[config.getMethodName](methodParams);
},
execute: (params) => (client as any)[config.getMethodName](params),
}),
createTool({
name: `upsert_${config.type}_template`,
Expand Down