test_hardcoded_filter
Verify Frappe API filtering functionality by testing hardcoded filters to bypass parameter validation issues.
Instructions
Test hardcoded filter to verify Frappe API filtering works. This bypasses all parameter validation issues.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doctype | Yes |
Implementation Reference
- src/tools/documents.py:921-950 (handler)The core handler function for the 'test_hardcoded_filter' tool. It uses a hardcoded filter to count unreconciled Bank Transactions via the Frappe API, bypassing dynamic filter parsing issues.@mcp.tool() async def test_hardcoded_filter(doctype: str) -> str: """ Test hardcoded filter to verify Frappe API filtering works. This bypasses all parameter validation issues. """ try: client = get_client() # Hard-code filters for testing if doctype == "Bank Transaction": # Test unreconciled filter test_filters = {"status": "Unreconciled"} params = { "fields": json.dumps(["count(name) as count"]), "filters": json.dumps(test_filters) } response = await client.get(f"api/resource/{doctype}", params=params) if "data" in response and response["data"]: count = response["data"][0].get("count", 0) return f"HARDCODED TEST: Found {count} {doctype} with status='Unreconciled'" else: return f"HARDCODED TEST: No data returned for {doctype}" else: return f"HARDCODED TEST: Only supports 'Bank Transaction' doctype for now" except Exception as error: return f"HARDCODED TEST ERROR: {error}"
- src/server.py:40-40 (registration)Top-level registration call in the MCP server setup that invokes documents.register_tools(mcp), which in turn registers the test_hardcoded_filter tool via its @mcp.tool() decorator.documents.register_tools(mcp)