list_templates
Retrieve and filter BoldSign document templates by creator, date, labels, brand IDs, and search criteria to find specific templates for document workflows.
Instructions
Retrieves a paginated list of BoldSign templates with options to filter by page number, page size, search key, template type, creator, labels, creation date range, and brand IDs.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pageSize": "<pageSize>",
"page": "<page>",
"templateType": "<templateType>"
},
"name": "list_templates"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageSize | Yes | ||
| page | Yes | ||
| searchKey | No | Optional. A search key to filter templates by properties such as name and email address. Provides a way to refine results based on specific criteria. | |
| templateType | Yes | Optional. Filters templates based on their type (all, mytemplates, sharedtemplate). Defaults to 'all'. | all |
| createdBy | No | Optional. Filters templates based on the email address(es) of their creators. | |
| templateLabels | No | Optional. Filters templates based on associated labels (tags). | |
| startDate | No | Optional. Filters templates created on or after this date (in YYYY-MM-DD format). | |
| endDate | No | Optional. Filters templates created on or before this date (in YYYY-MM-DD format). | |
| brandIds | No | Optional. Filters templates associated with the specified brand IDs. |
Implementation Reference
- The main handler function that executes the core logic of the 'list_templates' tool by calling the BoldSign TemplateApi.listTemplates method with the provided parameters and handling the response.
async function listTemplatesHandler(payload: ListTemplatesSchemaType): Promise<McpResponse> { try { const templateApi = new TemplateApi(); templateApi.basePath = configuration.getBasePath(); templateApi.setApiKey(configuration.getApiKey()); const templateRecords: TemplateRecords = await templateApi.listTemplates( payload.page, payload.templateType ?? undefined, payload.pageSize ?? undefined, payload.searchKey ?? undefined, undefined, payload.createdBy ?? undefined, payload.templateLabels ?? undefined, payload.startDate ?? undefined, payload.endDate ?? undefined, payload.brandIds ?? undefined, ); setAsTemplate(templateRecords.result); return handleMcpResponse({ data: templateRecords, }); } catch (error: any) { return handleMcpError(error); } } - Zod schema defining the input validation for the 'list_templates' tool, including parameters like pageSize, page, searchKey, templateType, etc.
const ListTemplatesSchema = z.object({ pageSize: z.number().int().min(1).max(100), page: z.number().int().min(1).default(1), searchKey: commonSchema.OptionalStringSchema.describe( 'Optional. A search key to filter templates by properties such as name and email address. Provides a way to refine results based on specific criteria.', ), templateType: z .enum(['all', 'mytemplates', 'sharedtemplate']) .optional() .nullable() .default('all') .describe( "Optional. Filters templates based on their type (all, mytemplates, sharedtemplate). Defaults to 'all'.", ), createdBy: z .array(commonSchema.EmailSchema.describe('Email address of the template creator.')) .optional() .nullable() .describe('Optional. Filters templates based on the email address(es) of their creators.'), templateLabels: z .array(z.string().describe('Label of the template.')) .optional() .nullable() .describe('Optional. Filters templates based on associated labels (tags).'), startDate: commonSchema.OptionalDateSchema.describe( 'Optional. Filters templates created on or after this date (in YYYY-MM-DD format).', ), endDate: commonSchema.OptionalDateSchema.describe( 'Optional. Filters templates created on or before this date (in YYYY-MM-DD format).', ), brandIds: z .array( commonSchema.InputIdSchema.describe( 'The unique identifier (ID) of the brand to be used for depicting a brand.', ), ) .optional() .nullable() .describe('Optional. Filters templates associated with the specified brand IDs.'), }); - src/tools/templatesTools/listTemplates.ts:53-62 (registration)Tool definition object for 'list_templates', specifying method name, description, input schema, and a thin handler wrapper that delegates to the main handler.
export const listTemplatesToolDefinition: BoldSignTool = { method: ToolNames.ListTemplates.toString(), name: 'List templates', description: 'Retrieves a paginated list of BoldSign templates with options to filter by page number, page size, search key, template type, creator, labels, creation date range, and brand IDs.', inputSchema: ListTemplatesSchema, async handler(args: unknown): Promise<McpResponse> { return await listTemplatesHandler(args as ListTemplatesSchemaType); }, }; - src/tools/templatesTools/index.ts:6-10 (registration)Inclusion of listTemplatesToolDefinition in the array of templates API tool definitions.
export const templatesApiToolsDefinitions: BoldSignTool[] = [ sendDocumentFromTemplateDynamicToolDefinition, listTemplatesToolDefinition, getTemplatePropertiesToolDefinition, ]; - src/tools/index.ts:8-14 (registration)Main tools definitions array that includes templatesApiToolsDefinitions via spread operator, effectively registering all tools including 'list_templates'.
export const definitions: BoldSignTool[] = [ ...contactsApiToolsDefinitions, ...documentsApiToolsDefinitions, ...templatesApiToolsDefinitions, ...usersApiToolsDefinitions, ...teamsApiToolsDefinitions, ];