Skip to main content
Glama

send_document_from_template

Send documents for electronic signatures using predefined templates. Specify recipients, populate form fields, and configure sending options to create and distribute signing requests.

Instructions

Initiates the process of sending a document based on a pre-defined template. This tool allows you to specify recipients, form field values, and various sending options to create and send a document for signing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateIdYesRequired. The unique identifier (ID) of the template to be used for sending the document. This can be obtained from the list templates tool.
bodyYesOptional. The main content and settings for sending the document.

Implementation Reference

  • Primary handler function that executes the core logic: initializes TemplateApi, prepares roles, calls sendUsingTemplate API, and handles response/error.
    async function sendDocumentFromTemplateDynamicHandler(
      payload: SendDocumentFromTemplateSchemaType,
    ): Promise<McpResponse> {
      try {
        const templateApi = new TemplateApi();
        templateApi.basePath = configuration.getBasePath();
        templateApi.setApiKey(configuration.getApiKey());
        const roles = getRolesFromRequestPayload(payload);
        const documentCreated: DocumentCreated = await templateApi.sendUsingTemplate(payload.templateId, {
          fileUrls: payload.body.fileUrls,
          title: payload.body.title ?? undefined,
          message: payload.body.message ?? undefined,
          roles: roles,
          brandId: payload.body.brandId ?? undefined,
          disableEmails: payload.body.disableEmails ?? undefined,
          disableSMS: payload.body.disableSMS ?? undefined,
          hideDocumentId: payload.body.hideDocumentId ?? undefined,
          reminderSettings: payload.body.reminderSettings ?? undefined,
          cc: payload.body.cc ?? undefined,
          expiryDays: payload.body.expiryDays ?? undefined,
          enablePrintAndSign: payload.body.enablePrintAndSign ?? undefined,
          enableReassign: payload.body.enableReassign ?? undefined,
          enableSigningOrder: payload.body.enableSigningOrder ?? undefined,
          disableExpiryAlert: payload.body.disableExpiryAlert ?? undefined,
          scheduledSendTime: payload.body.scheduledSendTime ?? undefined,
          allowScheduledSend: payload.body.allowScheduledSend ?? undefined,
        } as SendForSignFromTemplateForm);
        return handleMcpResponse({
          data: documentCreated,
        });
      } catch (error: any) {
        return handleMcpError(error);
      }
    }
  • Zod input schema for the tool parameters, defining templateId and body with all options like roles, cc, reminders, expiry, etc. Sub-schemas (SignerDetailsSchema, RolesSchema, etc.) defined lines 9-110.
    const SendDocumentFromTemplateSchema = z.object({
      templateId: commonSchema.InputIdSchema.describe(
        'Required. The unique identifier (ID) of the template to be used for sending the document. This can be obtained from the list templates tool.',
      ),
      body: z
        .object({
          title: commonSchema.OptionalStringSchema.describe(
            'This is the title of the document that will be displayed in the BoldSign user interface as well as in the signature request email.',
          ),
          message: commonSchema.OptionalStringSchema.describe(
            'A message for all the recipients. You can include the instructions that the signer should know before signing the document.',
          ),
          fileUrls: z
            .array(commonSchema.FileUrlSchema)
            .max(25)
            .optional()
            .nullable()
            .describe('Optional. An array of URLs pointing to additional files to be attached to the document.'),
          roles: RolesSchema,
          cc: z
            .array(
              z
                .object({
                  emailAddress: z.string().email().describe('Email address of the CC recipient.'),
                })
                .describe('Email address of the CC recipients.'),
            )
            .optional()
            .nullable()
            .describe(
              'Optional. An array of email addresses to be added as carbon copy (CC) recipients to the document. CC recipients will receive a copy of the completed document.',
            ),
          brandId: commonSchema.InputIdSchema.optional()
            .nullable()
            .describe(
              'The unique identifier (ID) of the brand to be associated with this document. If provided, the document will be branded accordingly.',
            ),
          disableEmails: commonSchema.OptionalBooleanSchema.describe(
            'Disables the sending of document related emails to all the recipients. The default value is false.',
          ),
          disableSMS: commonSchema.OptionalBooleanSchema.describe(
            'Disables the sending of document related SMS to all the recipients. The default value is false.',
          ),
          hideDocumentId: commonSchema.OptionalBooleanSchema.describe(
            'Decides whether the document ID should be hidden or not.',
          ),
          reminderSettings: z
            .object({
              enableAutoReminder: commonSchema.OptionalBooleanSchema.describe(
                'A flag indicating whether automatic reminders should be enabled for this document.',
              ),
              reminderDays: commonSchema.OptionalIntegerSchema.describe(
                'The number of days after which a reminder should be sent to the signers.',
              ),
              reminderCount: commonSchema.OptionalIntegerSchema.describe(
                'The maximum number of reminders to be sent to the signers.',
              ),
            })
            .optional()
            .nullable()
            .describe('Optional. Settings for automated reminders to be sent to the signers.'),
          expiryDays: commonSchema.OptionalIntegerSchema.default(60).describe(
            'The number of days after which the document expires. The default value is 60 days.',
          ),
          enablePrintAndSign: commonSchema.OptionalBooleanSchema.describe(
            'Allows the signer to print the document, sign, and upload it. The default value is false.',
          ),
          enableReassign: commonSchema.OptionalBooleanSchema.describe(
            'Allows the signer to reassign the signature request to another person. The default value is true.',
          ),
          enableSigningOrder: commonSchema.OptionalBooleanSchema.describe(
            'Enables or disables the signing order. If this option is enabled, then the signers can only sign the document in the specified order and cannot sign in parallel. The default value is false.',
          ),
          disableExpiryAlert: commonSchema.OptionalBooleanSchema.describe(
            'Disables the alert, which was shown one day before the expiry of the document.',
          ),
          scheduledSendTime: commonSchema.OptionalIntegerSchema.describe(
            "This property allows you to specify the date and time in Unix Timestamp format to schedule a document for sending at a future time. The scheduled time must be at least 30 minutes from the current time and must not exceed the document's expiry date.",
          ),
          allowScheduledSend: commonSchema.OptionalIntegerSchema.describe(
            'Indicates whether scheduled sending is allowed for this document (e.g., 1 for allowed, 0 for not allowed).',
          ),
        })
        .describe('Optional. The main content and settings for sending the document.'),
    });
  • Tool definition object registering the method name, description, schema, and handler wrapper for the MCP tool.
    export const sendDocumentFromTemplateDynamicToolDefinition: BoldSignTool = {
      method: ToolNames.SendDocumentFromTemplate.toString(),
      name: 'Send document from template',
      description:
        'Initiates the process of sending a document based on a pre-defined template. This tool allows you to specify recipients, form field values, and various sending options to create and send a document for signing.',
      inputSchema: SendDocumentFromTemplateSchema,
      async handler(args: unknown): Promise<McpResponse> {
        return await sendDocumentFromTemplateDynamicHandler(args as SendDocumentFromTemplateSchemaType);
      },
    };
  • Helper function to transform input roles schema into BoldSign Role objects array used in the API call.
    function getRolesFromRequestPayload(payload: SendDocumentFromTemplateSchemaType): Array<Role> {
      const roles = new Array<Role>();
      payload?.body.roles?.forEach((requestRole) => {
        const role = new Role();
        role.roleIndex = requestRole.roleIndex ?? undefined;
        role.signerName = requestRole.signerDetails?.signerName ?? undefined;
        role.signerOrder = requestRole.signerDetails?.signerOrder ?? undefined;
        role.signerEmail = requestRole.signerDetails?.signerEmail ?? undefined;
        role.privateMessage = requestRole.privateMessage ?? undefined;
        role.authenticationCode = requestRole.authenticationCode ?? undefined;
        role.enableEmailOTP = requestRole.enableEmailOTP ?? undefined;
        role.authenticationType = requestRole.authenticationType
          ? (requestRole.authenticationType as unknown as Role.AuthenticationTypeEnum)
          : undefined;
        role.phoneNumber = requestRole.phoneNumber ?? undefined;
        role.deliveryMode = requestRole.deliveryMode
          ? (requestRole.deliveryMode as unknown as Role.DeliveryModeEnum)
          : undefined;
        role.signerType = requestRole.signerType
          ? (requestRole.signerType as unknown as Role.SignerTypeEnum)
          : undefined;
        role.signerRole = requestRole.signerRole ?? undefined;
        role.allowFieldConfiguration = requestRole.allowFieldConfiguration ?? undefined;
        role.existingFormFields = requestRole.existingFormFields ?? undefined;
        role.enableQes = requestRole.enableQes ?? undefined;
        roles.push(role);
      });
      return roles;
    }
  • Local registration in templates tools module, including this tool in the templatesApiToolsDefinitions array, which is spread into main tools.
    export const templatesApiToolsDefinitions: BoldSignTool[] = [
      sendDocumentFromTemplateDynamicToolDefinition,
      listTemplatesToolDefinition,
      getTemplatePropertiesToolDefinition,
    ];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It states the tool 'creates and sends a document for signing,' implying a write operation with side effects, but lacks details on permissions required, rate limits, idempotency, or what happens after sending (e.g., document status changes). This is inadequate for a mutation tool with complex parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, stating the core purpose in the first sentence. Both sentences earn their place by clarifying the tool's function and key parameters. No redundant or verbose language is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (2 parameters with nested objects, no annotations, no output schema), the description is insufficient. It doesn't explain the return value, error conditions, or behavioral nuances like authentication requirements or side effects. For a mutation tool with rich input schema, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds minimal value beyond the schema, mentioning 'recipients, form field values, and various sending options' which loosely maps to parameters like 'roles' and 'body' but doesn't provide additional syntax or format details. Baseline 3 is appropriate given high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Initiates the process of sending a document based on a pre-defined template' with specific actions like specifying recipients, form field values, and sending options. It distinguishes from siblings like 'list_templates' or 'get_template_properties' by focusing on sending rather than retrieval, though it doesn't explicitly name alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives is provided. The description mentions using a template but doesn't clarify when to choose this over non-template sending methods (if they exist) or other document-related tools. Usage context is implied but not articulated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/boldsign/boldsign-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server