create_embedded_editor_from_template
Generate an embedded editor for signing by converting templates or template groups into documents within the SignNow platform.
Instructions
Create document/group from template and create embedded editor immediately. This tool is ONLY for templates and template groups. If you have document or document_group, use the alternative tool: create_embedded_editor
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entity_id | Yes | ID of the template or template group | |
| entity_type | No | Type of entity: 'template' or 'template_group' (optional). If you're passing it, make sure you know what type you have. If it's not found, try using a different type. | |
| name | No | Name for the new document or document group | |
| redirect_uri | No | Optional redirect URI after completion | |
| redirect_target | No | Optional redirect target: 'self' (default), 'blank' | |
| link_expiration | No | Optional link expiration in minutes (15-43200) |
Implementation Reference
- MCP tool registration (@mcp.tool) and handler function. Authenticates via token provider and delegates to the core _create_embedded_editor_from_template helper.name="create_embedded_editor_from_template", description=( "Create document/group from template and create embedded editor immediately. " "This tool is ONLY for templates and template groups. " "If you have document or document_group, use the alternative tool: create_embedded_editor" ), tags=["template", "template_group", "document", "document_group", "embedded_editor", "embedded", "workflow"], ) async def create_embedded_editor_from_template( ctx: Context, entity_id: Annotated[str, Field(description="ID of the template or template group")], entity_type: Annotated[ Literal["template", "template_group"] | None, Field(description="Type of entity: 'template' or 'template_group' (optional). If you're passing it, make sure you know what type you have. If it's not found, try using a different type."), ] = None, name: Annotated[str | None, Field(description="Name for the new document or document group")] = None, redirect_uri: Annotated[str | None, Field(description="Optional redirect URI after completion")] = None, redirect_target: Annotated[str | None, Field(description="Optional redirect target: 'self' (default), 'blank'")] = None, link_expiration: Annotated[int | None, Field(ge=15, le=43200, description="Optional link expiration in minutes (15-43200)")] = None, ) -> CreateEmbeddedEditorFromTemplateResponse: """Create document or document group from template and create embedded editor immediately. This tool is ONLY for templates and template groups. If you have document or document_group, use the alternative tool: create_embedded_editor This tool combines two operations: 1. Creates a document/group from template using create_from_template 2. Creates an embedded editor for the created entity using create_embedded_editor Args: entity_id: ID of the template or template group entity_type: Type of entity: 'template' or 'template_group' (optional). If you're passing it, make sure you know what type you have. If it's not found, try using a different type. name: Optional name for the new document or document group redirect_uri: Optional redirect URI after completion redirect_target: Optional redirect target: 'self', 'blank', or 'self' (default) link_expiration: Optional link expiration in minutes (15-43200) Returns: CreateEmbeddedEditorFromTemplateResponse with created entity info and embedded editor details """ token, client = _get_token_and_client(token_provider) # Initialize client and use the imported function from embedded_editor module return await _create_embedded_editor_from_template(entity_id, entity_type, name, redirect_uri, redirect_target, link_expiration, token, client, ctx)
- Core helper function that implements the tool logic: creates a document or document group from a template, then creates an embedded editor for it, reporting progress via MCP context.async def _create_embedded_editor_from_template( entity_id: str, entity_type: Literal["template", "template_group"] | None, name: str | None, redirect_uri: str | None, redirect_target: str | None, link_expiration: int | None, token: str, client: SignNowAPIClient, ctx: Context, ) -> CreateEmbeddedEditorFromTemplateResponse: """Private function to create document/group from template and create embedded editor immediately. Args: entity_id: ID of the template or template group entity_type: Type of entity: 'template' or 'template_group' (optional). If you're passing it, make sure you know what type you have. If it's not found, try using a different type. name: Optional name for the new document or document group redirect_uri: Optional redirect URI after completion redirect_target: Optional redirect target: 'self', 'blank', or 'self' (default) link_expiration: Optional link expiration in minutes (15-43200) token: Access token for SignNow API client: SignNow API client instance ctx: FastMCP context for progress reporting Returns: CreateEmbeddedEditorFromTemplateResponse with created entity info and embedded editor details """ # Report initial progress await ctx.report_progress(progress=1, total=3) # Import and use the create from template function directly from .create_from_template import _create_from_template # Use the imported function to create from template created_entity = _create_from_template(entity_id, entity_type, name, token, client) # Report progress after template creation await ctx.report_progress(progress=2, total=3) if created_entity.entity_type == "document_group": editor_response = _create_document_group_embedded_editor(client, token, created_entity.entity_id, redirect_uri, redirect_target, link_expiration) # Report final progress after embedded editor creation await ctx.report_progress(progress=3, total=3) return CreateEmbeddedEditorFromTemplateResponse( created_entity_id=created_entity.entity_id, created_entity_type=created_entity.entity_type, created_entity_name=created_entity.name, editor_id=editor_response.editor_url, editor_entity=editor_response.editor_entity, editor_url=editor_response.editor_url, ) else: editor_response = _create_document_embedded_editor(client, token, created_entity.entity_id, redirect_uri, redirect_target, link_expiration) # Report final progress after embedded editor creation await ctx.report_progress(progress=3, total=3) return CreateEmbeddedEditorFromTemplateResponse( created_entity_id=created_entity.entity_id, created_entity_type=created_entity.entity_type, created_entity_name=created_entity.name, editor_id=editor_response.editor_url, editor_entity=editor_response.editor_entity, editor_url=editor_response.editor_url, )
- Pydantic BaseModel defining the response schema for the create_embedded_editor_from_template tool.class CreateEmbeddedEditorFromTemplateResponse(BaseModel): """Response model for creating document/group from template and creating embedded editor immediately.""" created_entity_id: str = Field(..., description="ID of the created document or document group") created_entity_type: str = Field(..., description="Type of created entity: 'document' or 'document_group'") created_entity_name: str = Field(..., description="Name of the created entity") editor_id: str = Field(..., description="ID of the created embedded editor") editor_entity: str = Field(..., description="Type of editor entity: 'document' or 'document_group'") editor_url: str = Field(..., description="URL for the embedded editor")