compare_plays
Analyze and compare two dramatic plays by metrics and structural elements using the DraCor MCP Server. Identify differences in texts, character networks, and play information for research or study.
Instructions
Compare two plays in terms of metrics and structure.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| corpus_name1 | Yes | ||
| corpus_name2 | Yes | ||
| play_name1 | Yes | ||
| play_name2 | Yes |
Implementation Reference
- dracor_mcp_fastmcp.py:406-442 (handler)The compare_plays tool implementation, decorated with @mcp.tool() which registers it as an MCP tool. Fetches play metadata and metrics for two plays and returns a comparison dictionary.@mcp.tool() def compare_plays( corpus_name1: str, play_name1: str, corpus_name2: str, play_name2: str ) -> Dict: """Compare two plays in terms of metrics and structure.""" try: play1 = api_request(f"corpora/{corpus_name1}/plays/{play_name1}") play2 = api_request(f"corpora/{corpus_name2}/plays/{play_name2}") metrics1 = api_request(f"corpora/{corpus_name1}/plays/{play_name1}/metrics") metrics2 = api_request(f"corpora/{corpus_name2}/plays/{play_name2}/metrics") # Compile comparison data comparison = { "plays": [ { "title": play1.get("title"), "author": play1.get("authors", [{}])[0].get("name") if play1.get("authors") else None, "year": play1.get("yearNormalized"), "metrics": metrics1 }, { "title": play2.get("title"), "author": play2.get("authors", [{}])[0].get("name") if play2.get("authors") else None, "year": play2.get("yearNormalized"), "metrics": metrics2 } ] } return comparison except Exception as e: return {"error": str(e)}