Skip to main content
Glama

get_frappe_usage_info

Retrieve schema metadata and usage guidance for Frappe Framework DocTypes or workflows to understand structure and implementation details.

Instructions

    Get combined information about a DocType or workflow, including schema metadata and usage guidance.
    
    Args:
        doctype: DocType name (optional if workflow is provided)
        workflow: Workflow name (optional if doctype is provided)
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
doctypeNo
workflowNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'get_frappe_usage_info' tool. It fetches and formats DocType schema and workflow information from the Frappe API, handling both parameters optionally. Includes input validation, API calls, data extraction for required fields, submittable status, etc., and error handling.
    @mcp.tool()
    async def get_frappe_usage_info(
        doctype: Optional[str] = None,
        workflow: Optional[str] = None
    ) -> str:
        """
        Get combined information about a DocType or workflow, including schema metadata and usage guidance.
        
        Args:
            doctype: DocType name (optional if workflow is provided)
            workflow: Workflow name (optional if doctype is provided)
        """
        try:
            if not doctype and not workflow:
                return "Please provide either a doctype or workflow parameter"
            
            client = get_client()
            info_parts = []
            
            if doctype:
                # Get DocType schema information
                schema_response = await client.get(f"api/resource/DocType/{doctype}")
                
                if "data" in schema_response:
                    schema_data = schema_response["data"]
                    
                    # Extract key information
                    info = {
                        "doctype": doctype,
                        "module": schema_data.get("module"),
                        "description": schema_data.get("description"),
                        "is_submittable": schema_data.get("is_submittable", 0) == 1,
                        "is_tree": schema_data.get("is_tree", 0) == 1,
                        "naming_rule": schema_data.get("autoname"),
                        "required_fields": []
                    }
                    
                    # Get required fields
                    for field in schema_data.get("fields", []):
                        if field.get("reqd", 0) == 1:
                            info["required_fields"].append({
                                "fieldname": field.get("fieldname"),
                                "label": field.get("label"),
                                "fieldtype": field.get("fieldtype"),
                                "options": field.get("options")
                            })
                    
                    info_parts.append(f"DocType Information:\n{json.dumps(info, indent=2)}")
            
            if workflow:
                # Get workflow information
                try:
                    workflow_response = await client.get(f"api/resource/Workflow/{workflow}")
                    if "data" in workflow_response:
                        workflow_data = workflow_response["data"]
                        workflow_info = {
                            "workflow": workflow,
                            "document_type": workflow_data.get("document_type"),
                            "is_active": workflow_data.get("is_active", 0) == 1,
                            "workflow_states": workflow_data.get("states", []),
                            "transitions": workflow_data.get("transitions", [])
                        }
                        info_parts.append(f"Workflow Information:\n{json.dumps(workflow_info, indent=2)}")
                except:
                    info_parts.append(f"Could not retrieve workflow information for: {workflow}")
            
            return "\n\n".join(info_parts) if info_parts else "No information found"
                
        except Exception as error:
            return _format_error_response(error, "get_frappe_usage_info")
  • src/server.py:39-42 (registration)
    Registration of all tool modules in the main server setup, including schema.register_tools(mcp) which registers the get_frappe_usage_info tool via its @mcp.tool() decorator.
    helpers.register_tools(mcp)
    documents.register_tools(mcp)
    schema.register_tools(mcp)
    reports.register_tools(mcp)
  • Input schema defined via type hints and docstring: optional doctype (str) and workflow (str), returns formatted string with usage info.
        doctype: Optional[str] = None,
        workflow: Optional[str] = None
    ) -> str:
        """
        Get combined information about a DocType or workflow, including schema metadata and usage guidance.
        
        Args:
            doctype: DocType name (optional if workflow is provided)
            workflow: Workflow name (optional if doctype is provided)
        """
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a 'Get' operation, implying it's likely read-only, but doesn't explicitly confirm this or describe other behavioral traits such as authentication requirements, rate limits, error conditions, or what 'combined information' specifically entails. The description adds minimal context beyond the basic operation type.

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 appropriately sized and front-loaded, with the purpose stated clearly in the first sentence. The parameter explanations are concise and directly relevant. There's no unnecessary verbosity, though the formatting with extra whitespace could be slightly cleaner.

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 the tool has an output schema (which reduces the need to describe return values in the description) and no annotations, the description is moderately complete. It covers the purpose and parameters adequately but lacks behavioral details like error handling or performance characteristics. For a tool with 2 parameters and no annotations, it meets minimum viability but has clear gaps in transparency.

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 description adds significant value beyond the input schema, which has 0% description coverage. It explains that 'doctype' is a 'DocType name (optional if workflow is provided)' and 'workflow' is a 'Workflow name (optional if doctype is provided),' clarifying the optionality and mutual exclusivity relationship. This compensates well for the schema's lack of descriptions, though it doesn't detail format or examples.

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 as 'Get combined information about a DocType or workflow, including schema metadata and usage guidance.' This specifies the verb ('Get'), resources ('DocType or workflow'), and what information is retrieved ('combined information... including schema metadata and usage guidance'). However, it doesn't explicitly differentiate from sibling tools like 'get_doctype_schema' or 'get_doctype_list', which appear to serve related but distinct purposes.

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

Usage Guidelines3/5

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

The description provides implied usage guidance through the parameter documentation: 'doctype: DocType name (optional if workflow is provided)' and 'workflow: Workflow name (optional if doctype is provided).' This indicates the tool can be used with either parameter, but not necessarily when to choose this tool over alternatives like 'get_doctype_schema' or how it differs from them. No explicit when/when-not or alternative tool recommendations are provided.

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/appliedrelevance/frappe-mcp-server'

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