Skip to main content
Glama

get_document

Retrieve detailed information about SignNow documents, templates, or groups including field values and metadata for e-signature workflows.

Instructions

Get full document, template, template group or document group information with field values

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYesID of the document, template, template group or document group to retrieve
entity_typeNoType of entity: 'document', 'template', 'template_group' or 'document_group' (optional). If not provided, will be determined automatically

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentsYesList of documents in this group
entity_idYesDocument group ID
invite_idNoInvite ID for this group
group_nameYesName of the document group
entity_typeYesType of entity: 'document' or 'document_group'
last_updatedYesUnix timestamp of the last update
invite_statusNoStatus of the invite (e.g., 'pending')

Implementation Reference

  • MCP tool handler for 'get_document'. Defines input schema via Annotated fields and calls internal _get_document_impl. This is the primary execution point registered via @mcp.tool decorator.
        ctx: Context,
        entity_id: Annotated[str, Field(description="ID of the document, template, template group or document group to retrieve")],
        entity_type: Annotated[
            Literal["document", "document_group", "template", "template_group"] | None,
            Field(description="Type of entity: 'document', 'template', 'template_group' or 'document_group' (optional). If not provided, will be determined automatically"),
        ] = None,
    ) -> DocumentGroup:
        """Get full document, template, template group or document group information with field values.
    
        Always returns a unified DocumentGroup wrapper even for a single document.
    
        This tool retrieves complete information about a document, template, template group or document group,
        including all field values, roles, and metadata. If entity_type is not provided,
        the tool will automatically determine whether the entity is a document, template, template group or document group.
    
        For documents, returns a DocumentGroup with a single document.
        For templates, returns a DocumentGroup with a single template.
        For template groups, returns a DocumentGroup with all templates in the group.
        For document groups, returns a DocumentGroup with all documents in the group.
    
        Args:
            entity_id: ID of the document, template, template group or document group to retrieve
            entity_type: Type of entity: 'document', 'template', 'template_group' or 'document_group' (optional)
    
        Returns:
            DocumentGroup with complete information including field values for all documents
        """
        return _get_document_impl(ctx, entity_id, entity_type)
  • Core helper implementing the logic to retrieve and unify document/template/group data into DocumentGroup format, auto-detecting entity type and populating fields by calling sub-helpers.
    def _get_document(client: SignNowAPIClient, token: str, entity_id: str, entity_type: Literal["document", "document_group", "template", "template_group"] | None = None) -> DocumentGroup:
        """
        Get document or document group information with full field values.
    
        This function determines the entity type if not provided and returns
        a DocumentGroup with complete information including field values.
    
        Args:
            client: SignNow API client instance
            token: Access token for authentication
            entity_id: ID of the document or document group
            entity_type: Type of entity: 'document', 'template', 'template_group' or 'document_group' (optional)
    
        Returns:
            DocumentGroup with complete information including field values
    
        Raises:
            ValueError: If entity not found as either document or document group
        """
    
        # Determine entity type if not provided and get entity data
        document_data = None
        template_group_data = None
        group_data = None
    
        if not entity_type:
            # Try to determine entity type by attempting to get document first
            try:
                # Try to get document - if successful, it's a document
                document_data = client.get_document(token, entity_id)
                entity_type = "document"
            except:
                # If document not found, try document group
                try:
                    # Try to get document group - if successful, it's a document group
                    group_data = client.get_document_group_v2(token, entity_id)
                    entity_type = "document_group"
                except:
                    # If document group not found, try template group
                    try:
                        # Try to get template group - if successful, it's a template group
                        template_group_data = client.get_document_group_template(token, entity_id)
                        entity_type = "template_group"
                    except:
                        raise ValueError(f"Entity with ID {entity_id} not found as either document, template, template group or document group")
        else:
            # Entity type is provided, get the entity data
            if entity_type == "document_group":
                group_data = client.get_document_group_v2(token, entity_id)
            if entity_type == "template":
                document_data = client.get_document(token, entity_id)
            if entity_type == "template_group":
                template_group_data = client.get_document_group_template(token, entity_id)
            else:  # entity_type == "document"
                document_data = client.get_document(token, entity_id)
    
        # Get the appropriate data based on determined or provided entity type
        if entity_type == "document_group":
            return _get_full_document_group(client, token, group_data)
        if entity_type == "template_group":
            return _get_full_template_group(client, token, template_group_data)
        else:  # entity_type == "document"
            return _get_single_document_as_group(client, token, entity_id, document_data)
  • Pydantic model defining the output schema DocumentGroup, used as return type. Includes nested DocumentGroupDocument and DocumentField models (lines 31-48, 41-48).
    class DocumentGroup(BaseModel):
        """Document group model with all fields."""
    
        last_updated: int = Field(..., description="Unix timestamp of the last update")
        entity_id: str = Field(..., description="Document group ID")
        group_name: str = Field(..., description="Name of the document group")
        entity_type: str = Field(..., description="Type of entity: 'document' or 'document_group'")
        invite_id: str | None = Field(None, description="Invite ID for this group")
        invite_status: str | None = Field(None, description="Status of the invite (e.g., 'pending')")
        documents: list[DocumentGroupDocument] = Field(..., description="List of documents in this group")
  • Tool registration entry point. Calls signnow.bind() which registers all tools including 'get_document' via decorators in signnow.py.
    def register_tools(mcp: Any, cfg: Any) -> None:
        signnow.bind(mcp, cfg)
  • Supporting helper to extract and populate field values from SignNow DocumentResponse into MCP DocumentGroupDocument format.
    def _get_full_document(client: SignNowAPIClient, token: str, document_id: str, document_data: DocumentResponse) -> DocumentGroupDocument:
        """
        Get full document information including field values.
    
        This function retrieves a document with all its metadata and field values.
        The basic information (id, name, roles) comes from the document endpoint,
        while field values are retrieved separately using get_document_fields.
    
        Args:
            client: SignNow API client instance
            token: Access token for authentication
            document_id: ID of the document to retrieve
            document_data: Pre-fetched document data to avoid duplicate API calls
    
        Returns:
            DocumentGroupDocument with complete document information including field values
        """
    
        # Use provided document data
        document_response = document_data
    
        # Create DocumentField objects with values
        document_fields = []
    
        for field in document_response.fields:
            if field.type == "text":
                document_fields.append(
                    DocumentField(
                        id=field.id,
                        type=field.type,
                        role_id=field.role,  # Using role name as role_id for consistency
                        value=field.json_attributes.prefilled_text or "",
                        name=field.json_attributes.name,
                    )
                )
    
        return DocumentGroupDocument(id=document_response.id, name=document_response.document_name, roles=[role.name for role in document_response.roles], fields=document_fields)
Behavior2/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 of behavioral disclosure. It mentions retrieving 'information with field values', which implies a read-only operation, but does not specify permissions, rate limits, error handling, or output format. This is inadequate for a tool with no annotation coverage, as critical behavioral traits are omitted.

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 a single, efficient sentence that front-loads the core action ('Get full document...'). It avoids unnecessary words, but could be slightly improved by structuring key details more explicitly, such as separating entity types for clarity.

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 an output schema exists, the description need not explain return values, and schema coverage is high for inputs. However, with no annotations and multiple sibling tools, the description lacks context on usage scenarios and behavioral details, making it incomplete for optimal agent decision-making in this complex environment.

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%, with clear descriptions for both parameters in the input schema. The description adds minimal value beyond the schema by implying retrieval of 'field values', but does not elaborate on parameter usage or constraints. Given the high schema coverage, a baseline score of 3 is appropriate as 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 verb ('Get') and the resources ('full document, template, template group or document group information with field values'), making the purpose explicit. However, it does not distinguish this tool from siblings like 'get_document_download_link' or 'list_all_templates', which might retrieve similar entities but in different forms or scopes, so it lacks sibling differentiation.

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. For example, it does not specify if this is for retrieving detailed information versus a download link (vs. 'get_document_download_link') or for single entities versus lists (vs. 'list_all_templates'), leaving the agent without context for tool selection.

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