Skip to main content
Glama

list_all_templates

Retrieve all available templates and template groups with basic information from the SignNow e-signature platform. This tool provides a simplified list for document workflow management.

Instructions

Get simplified list of all templates and template groups with basic information

Note: If your client supports MCP Resources, prefer the resource version of this endpoint; this tool exists as a compatibility fallback for tool-only clients.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
templatesYes
total_countYesTotal number of templates

Implementation Reference

  • Core handler function that executes the tool logic: fetches all folders, processes templates in root and subfolders, retrieves template groups, reports progress, and constructs the TemplateSummaryList response.
    async def _list_all_templates(ctx: Context, token: str, client: SignNowAPIClient) -> TemplateSummaryList:
        """Get all templates and template groups from all folders.
    
        This function combines both individual templates and template groups into a single response.
        Individual templates are marked with entity_type='template' and template groups with entity_type='template_group'.
    
        Note: Individual templates are deprecated. For new implementations, prefer using template groups
        which are more feature-rich and actively maintained.
    
        Args:
            ctx: FastMCP context object
            token: Access token for SignNow API
            client: SignNow API client instance
    
        Returns:
            TemplateSummaryList with all templates and template groups combined
        """
        await ctx.report_progress(progress=0, message="Selecting all folders")
    
        # Get all folders first
        folders_response = client.get_folders(token)
    
        # Calculate total progress steps: root folder + subfolders + template groups
        total = len(folders_response.folders) + 2  # +1 for root folder, +1 for template groups
        progress = 1
    
        all_templates = []
    
        # Process root folder
        await ctx.report_progress(progress=progress, total=total, message="Processing root folder")
        progress += 1
    
        root_folder = folders_response
        if hasattr(root_folder, "documents") and root_folder.documents:
            for doc in root_folder.documents:
                # Check if document is a template
                if doc.get("template", False):
                    # Extract role names from roles array
                    role_names = []
                    if doc.get("roles"):
                        role_names = [role.get("name", "") for role in doc["roles"] if role.get("name")]
    
                    all_templates.append(
                        TemplateSummary(
                            id=doc["id"],
                            name=doc.get("document_name", doc.get("name", "")),
                            entity_type="template",
                            folder_id=root_folder.id,
                            last_updated=int(doc.get("updated", 0)) if doc.get("updated") else 0,
                            is_prepared=True,  # Default to True for individual templates
                            roles=role_names,
                        )
                    )
    
        # Process all subfolders
        for folder in folders_response.folders:
            await ctx.report_progress(progress=progress, total=total, message="Processing subfolder {folder.name}")
            progress += 1
    
            try:
                # Get folder content with entity_type='template'
                folder_content = client.get_folder_by_id(token, folder.id, entity_type="template")
    
                if folder_content.documents:
                    for doc in folder_content.documents:
                        # Check if document is a template
                        if doc.get("template", False):
                            # Extract role names from roles array
                            role_names = []
                            if doc.get("roles"):
                                role_names = [role.get("name", "") for role in doc["roles"] if role.get("name")]
    
                            all_templates.append(
                                TemplateSummary(
                                    id=doc["id"],
                                    name=doc.get("document_name", doc.get("name", "")),
                                    entity_type="template",
                                    folder_id=folder.id,
                                    last_updated=int(doc.get("updated", 0)) if doc.get("updated") else 0,
                                    is_prepared=True,  # Default to True for individual templates
                                    roles=role_names,
                                )
                            )
            except Exception:
                # Skip folders that can't be accessed
                continue
    
        # Get template groups
        await ctx.report_progress(progress=progress, total=total, message="Processing template groups")
        progress += 1
    
        # Use the client to get document template groups - now returns validated model
        full_response = client.get_document_template_groups(token, limit=50)
    
        # Convert to simplified structure
        for template_group in full_response.document_group_templates:
            # Collect all unique roles from all templates in the group
            all_roles = set()
            for template in template_group.templates:
                all_roles.update(template.get("roles", []))
    
            template_summary = TemplateSummary(
                id=template_group.template_group_id,
                name=template_group.template_group_name,
                entity_type="template_group",
                folder_id=template_group.folder_id,
                last_updated=template_group.last_updated,
                is_prepared=template_group.is_prepared,
                roles=list(all_roles),
            )
            all_templates.append(template_summary)
    
        return TemplateSummaryList(templates=all_templates, total_count=len(all_templates))
  • Registration of the MCP tool 'list_all_templates' with @mcp.tool decorator, including description, tags, and the handler function that delegates to the implementation.
    @mcp.tool(
        name="list_all_templates",
        description="Get simplified list of all templates and template groups with basic information" + TOOL_FALLBACK_SUFFIX,
        tags=["template", "template_group", "list"],
    )
    async def list_all_templates(ctx: Context) -> TemplateSummaryList:
        """Get all templates and template groups from all folders.
    
        This tool combines both individual templates and template groups into a single response.
        Individual templates are marked with entity_type='template' and template groups with entity_type='template_group'.
    
        Note: Individual templates are deprecated. For new implementations, prefer using template groups
        which are more feature-rich and actively maintained.
        """
        return await _list_all_templates_impl(ctx)
  • Pydantic schema definitions for the tool's output: TemplateSummary (individual template/group info) and TemplateSummaryList (response wrapper).
    class TemplateSummary(BaseModel):
        """Simplified template information for listing."""
    
        id: str = Field(..., description="Template group ID")
        name: str = Field(..., description="Template group name")
        entity_type: str = Field(..., description="Type of entity: 'template' or 'template_group'")
        folder_id: str | None = Field(None, description="Folder ID if stored in folder")
        last_updated: int = Field(..., description="Unix timestamp of last update")
        is_prepared: bool = Field(..., description="Whether the group is ready for sending")
        roles: list[str] = Field(..., description="All unique roles from all templates in the group")
    
    
    class TemplateSummaryList(BaseModel):
        """List of simplified template summaries."""
    
        templates: list[TemplateSummary]
        total_count: int = Field(..., description="Total number of templates")
  • Helper function that retrieves authentication token and client, then calls the core _list_all_templates implementation.
    async def _list_all_templates_impl(ctx: Context) -> TemplateSummaryList:
        token, client = _get_token_and_client(token_provider)
        return await _list_all_templates(ctx, token, client)
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It mentions the tool returns a 'simplified list' with 'basic information,' which adds some behavioral context about the output's nature. However, it lacks details on permissions, rate limits, or error handling, leaving gaps for a tool with no annotation coverage.

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 front-loaded with the core purpose in the first sentence, followed by a concise note on usage guidelines. Both sentences earn their place by providing essential information without redundancy, making it efficient and well-structured.

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

Completeness4/5

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

Given the tool's low complexity (0 parameters, output schema exists), the description is reasonably complete. It covers purpose and usage guidelines effectively. However, with no annotations and an output schema, it could benefit from more behavioral details like response format hints, though the output schema mitigates this gap.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter information is needed. The description appropriately does not discuss parameters, focusing instead on the tool's purpose and usage guidelines, which aligns with the baseline for zero parameters.

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 with the verb 'Get' and specifies the resource 'simplified list of all templates and template groups with basic information.' It distinguishes itself from potential sibling tools by emphasizing 'simplified' and 'basic information,' though it doesn't explicitly differentiate from all listed siblings like 'list_document_groups.'

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

Usage Guidelines5/5

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

The description provides explicit usage guidance by stating 'prefer the resource version of this endpoint' and clarifying that this tool is 'a compatibility fallback for tool-only clients.' This directly addresses when to use alternatives and when this tool is appropriate, offering clear context for decision-making.

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