Skip to main content
Glama

create_from_template

Generate documents or document groups using existing SignNow templates or template groups to streamline document creation.

Instructions

Create a new document or document group from an existing template or template group

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYesID of the template or template group
entity_typeNoType 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.
nameNoOptional name for the new document group or document (required for template groups)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the created entity
entity_idYesID of the created document or document group
entity_typeYesType of created entity: 'document' or 'document_group'

Implementation Reference

  • Handler function decorated with @mcp.tool for registration of 'create_from_template'. Executes the tool by getting auth token/client and delegating to helper _create_from_template.
    @mcp.tool(
        name="create_from_template",
        description="Create a new document or document group from an existing template or template group",
        tags=["template", "template_group", "document", "document_group", "create", "workflow"],
    )
    def create_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="Optional name for the new document group or document (required for template groups)")] = None,
    ) -> CreateFromTemplateResponse:
        """Create a new document or document group from an existing template or template group.
    
        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 group or document (required for template groups)
    
        Returns:
            CreateFromTemplateResponse with created entity ID, type and name
        """
        token, client = _get_token_and_client(token_provider)
    
        return _create_from_template(entity_id, entity_type, name, token, client)
  • Pydantic response schema for the create_from_template tool.
    class CreateFromTemplateResponse(BaseModel):
        """Response model for creating document/group from template."""
    
        entity_id: str = Field(..., description="ID of the created document or document group")
        entity_type: str = Field(..., description="Type of created entity: 'document' or 'document_group'")
        name: str = Field(..., description="Name of the created entity")
  • Main helper function implementing the core logic: determines entity type, handles name resolution, and calls specific creation functions for document or document group from template.
    def _create_from_template(entity_id: str, entity_type: Literal["template", "template_group"] | None, name: str | None, token: str, client: SignNowAPIClient) -> CreateFromTemplateResponse:
        """Private function to create a new document or document group from an existing template or template group.
    
        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 group or document (required for template groups)
            token: Access token for SignNow API
            client: SignNow API client instance
    
        Returns:
            CreateFromTemplateResponse with created entity ID, type and name
        """
    
        # Find template group if needed (for entity type detection or name extraction)
        found_template_group = None
        if not entity_type:
            found_template_group = _find_template_group(entity_id, token, client)
    
        # Determine entity type if not provided
        if not entity_type:
            if found_template_group:
                entity_type = "template_group"
            else:
                entity_type = "template"
    
        if entity_type == "template_group":
            # If name is not provided, try to get it from found_template_group
            if name is None:
                if found_template_group:
                    # Use name from found template group
                    name = found_template_group.template_group_name
                else:
                    # found_template_group was not found, get it by ID to extract name
                    found_template_group = _find_template_group(entity_id, token, client)
                    if found_template_group:
                        # Use name from found template group
                        name = found_template_group.template_group_name
                    else:
                        # Get template group by ID to extract name (more reliable method)
                        template_group_data = client.get_document_group_template(token, entity_id)
                        name = template_group_data.group_name
    
            return _create_document_group_from_template(client, token, entity_id, name)
        else:
            # Create document from template
            return _create_document_from_template(client, token, entity_id, name)
  • Helper to create a single document from a template using SignNow API.
    def _create_document_from_template(client: SignNowAPIClient, token: str, entity_id: str, name: str | None) -> CreateFromTemplateResponse:
        """Private function to create document from template."""
        from signnow_client import CreateDocumentFromTemplateRequest
    
        # Prepare request data
        request_data = None
        if name:
            request_data = CreateDocumentFromTemplateRequest(document_name=name)
    
        # Create document from template
        response = client.create_document_from_template(token, entity_id, request_data)
    
        # Use provided name or fallback to response document_name or entity_id
        document_name = name or getattr(response, "document_name", None) or f"Document_{response.id[:8]}"
    
        return CreateFromTemplateResponse(entity_id=response.id, entity_type="document", name=document_name)
  • Helper to create a document group from a template group using SignNow API.
    def _create_document_group_from_template(client: SignNowAPIClient, token: str, entity_id: str, name: str) -> CreateFromTemplateResponse:
        """Private function to create document group from template group."""
        from signnow_client import CreateDocumentGroupFromTemplateRequest
    
        if not name:
            raise ValueError("name is required when creating document group from template group")
    
        # Prepare request data
        request_data = CreateDocumentGroupFromTemplateRequest(group_name=name)
    
        # Create document group from template group
        response = client.create_document_group_from_template(token, entity_id, request_data)
    
        # Extract document group ID from response data
        response_data = response.data
        if isinstance(response_data, dict) and "unique_id" in response_data:
            created_id = response_data["unique_id"]
        elif isinstance(response_data, dict) and "id" in response_data:
            created_id = response_data["id"]
        elif isinstance(response_data, dict) and "group_id" in response_data:
            created_id = response_data["group_id"]
        else:
            created_id = str(response_data.get("id", response_data.get("group_id", "unknown")))
    
        return CreateFromTemplateResponse(entity_id=created_id, entity_type="document_group", name=name)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool creates documents/groups but doesn't disclose behavioral traits like required permissions, whether this is a write operation (implied but not explicit), potential side effects, rate limits, or what the output contains. For a creation tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part of the sentence earns its place by specifying what's created and from what source.

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

Completeness3/5

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

Given that there's an output schema (which handles return values), 100% schema coverage, and no annotations, the description is minimally adequate but incomplete. It covers the basic purpose but lacks usage guidelines and behavioral transparency needed for a creation tool in a context with many similar siblings. The output schema reduces the burden, but gaps remain.

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 already documents all three parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema—it doesn't explain the relationship between entity_id and entity_type, or clarify when name is required. Baseline 3 is appropriate when the schema does the heavy lifting.

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 action ('create') and resource ('new document or document group from an existing template or template group'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from its many siblings (like create_embedded_editor_from_template or create_embedded_invite_from_template), which all involve creation from templates but for different purposes.

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?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools that also create from templates (e.g., create_embedded_editor_from_template, create_embedded_invite_from_template), there's no indication of what distinguishes this general document creation from those more specific use cases. The input schema hints at entity_type but doesn't clarify usage context.

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/signnow/sn-mcp-server'

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