@boldsign/mcp
Version:
Model Context Protocol (MCP) server for BoldSign API
33 lines (32 loc) • 1.42 kB
JavaScript
import { TemplateApi } from 'boldsign';
import { z } from 'zod';
import * as commonSchema from '../../utils/commonSchema.js';
import { configuration } from '../../utils/constants.js';
import { handleMcpError, handleMcpResponse } from '../../utils/toolsUtils.js';
import ToolNames from '../toolNames.js';
const GetTemplatePropertiesSchema = z.object({
templateId: commonSchema.InputIdSchema.describe('Required. The unique identifier (ID) of the template to retrieve. This can be obtained from the list templates tool.'),
});
export const getTemplatePropertiesToolDefinition = {
method: ToolNames.GetTemplateProperties.toString(),
name: 'Get template properties',
description: 'Retrieves the detailed properties and settings of a specific BoldSign template using its unique template ID.',
inputSchema: GetTemplatePropertiesSchema,
async handler(args) {
return await getTemplatePropertiesHandler(args);
},
};
async function getTemplatePropertiesHandler(payload) {
try {
const templateApi = new TemplateApi();
templateApi.basePath = configuration.getBasePath();
templateApi.setApiKey(configuration.getApiKey());
const templateProperties = await templateApi.getProperties(payload.templateId);
return handleMcpResponse({
data: templateProperties,
});
}
catch (error) {
return handleMcpError(error);
}
}