hanzo-mcp 0.7.6__py3-none-any.whl → 0.8.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hanzo-mcp might be problematic. Click here for more details.
- hanzo_mcp/__init__.py +7 -1
- hanzo_mcp/__main__.py +1 -1
- hanzo_mcp/analytics/__init__.py +2 -2
- hanzo_mcp/analytics/posthog_analytics.py +76 -82
- hanzo_mcp/cli.py +31 -36
- hanzo_mcp/cli_enhanced.py +94 -72
- hanzo_mcp/cli_plugin.py +27 -17
- hanzo_mcp/config/__init__.py +2 -2
- hanzo_mcp/config/settings.py +112 -88
- hanzo_mcp/config/tool_config.py +32 -34
- hanzo_mcp/dev_server.py +66 -67
- hanzo_mcp/prompts/__init__.py +94 -12
- hanzo_mcp/prompts/enhanced_prompts.py +809 -0
- hanzo_mcp/prompts/example_custom_prompt.py +6 -5
- hanzo_mcp/prompts/project_todo_reminder.py +0 -1
- hanzo_mcp/prompts/tool_explorer.py +10 -7
- hanzo_mcp/server.py +17 -21
- hanzo_mcp/server_enhanced.py +15 -22
- hanzo_mcp/tools/__init__.py +56 -28
- hanzo_mcp/tools/agent/__init__.py +16 -19
- hanzo_mcp/tools/agent/agent.py +82 -65
- hanzo_mcp/tools/agent/agent_tool.py +152 -122
- hanzo_mcp/tools/agent/agent_tool_v1_deprecated.py +66 -62
- hanzo_mcp/tools/agent/clarification_protocol.py +55 -50
- hanzo_mcp/tools/agent/clarification_tool.py +11 -10
- hanzo_mcp/tools/agent/claude_cli_tool.py +21 -20
- hanzo_mcp/tools/agent/claude_desktop_auth.py +130 -144
- hanzo_mcp/tools/agent/cli_agent_base.py +59 -53
- hanzo_mcp/tools/agent/code_auth.py +102 -107
- hanzo_mcp/tools/agent/code_auth_tool.py +28 -27
- hanzo_mcp/tools/agent/codex_cli_tool.py +20 -19
- hanzo_mcp/tools/agent/critic_tool.py +86 -73
- hanzo_mcp/tools/agent/gemini_cli_tool.py +21 -20
- hanzo_mcp/tools/agent/grok_cli_tool.py +21 -20
- hanzo_mcp/tools/agent/iching_tool.py +404 -139
- hanzo_mcp/tools/agent/network_tool.py +89 -73
- hanzo_mcp/tools/agent/prompt.py +2 -1
- hanzo_mcp/tools/agent/review_tool.py +101 -98
- hanzo_mcp/tools/agent/swarm_alias.py +87 -0
- hanzo_mcp/tools/agent/swarm_tool.py +246 -161
- hanzo_mcp/tools/agent/swarm_tool_v1_deprecated.py +134 -92
- hanzo_mcp/tools/agent/tool_adapter.py +21 -11
- hanzo_mcp/tools/common/__init__.py +1 -1
- hanzo_mcp/tools/common/base.py +3 -5
- hanzo_mcp/tools/common/batch_tool.py +46 -39
- hanzo_mcp/tools/common/config_tool.py +120 -84
- hanzo_mcp/tools/common/context.py +1 -5
- hanzo_mcp/tools/common/context_fix.py +5 -3
- hanzo_mcp/tools/common/critic_tool.py +4 -8
- hanzo_mcp/tools/common/decorators.py +58 -56
- hanzo_mcp/tools/common/enhanced_base.py +29 -32
- hanzo_mcp/tools/common/fastmcp_pagination.py +91 -94
- hanzo_mcp/tools/common/forgiving_edit.py +91 -87
- hanzo_mcp/tools/common/mode.py +15 -17
- hanzo_mcp/tools/common/mode_loader.py +27 -24
- hanzo_mcp/tools/common/paginated_base.py +61 -53
- hanzo_mcp/tools/common/paginated_response.py +72 -79
- hanzo_mcp/tools/common/pagination.py +50 -53
- hanzo_mcp/tools/common/permissions.py +4 -4
- hanzo_mcp/tools/common/personality.py +186 -138
- hanzo_mcp/tools/common/plugin_loader.py +54 -54
- hanzo_mcp/tools/common/stats.py +65 -47
- hanzo_mcp/tools/common/test_helpers.py +31 -0
- hanzo_mcp/tools/common/thinking_tool.py +4 -8
- hanzo_mcp/tools/common/tool_disable.py +17 -12
- hanzo_mcp/tools/common/tool_enable.py +13 -14
- hanzo_mcp/tools/common/tool_list.py +36 -28
- hanzo_mcp/tools/common/truncate.py +23 -23
- hanzo_mcp/tools/config/__init__.py +4 -4
- hanzo_mcp/tools/config/config_tool.py +42 -29
- hanzo_mcp/tools/config/index_config.py +37 -34
- hanzo_mcp/tools/config/mode_tool.py +175 -55
- hanzo_mcp/tools/database/__init__.py +15 -12
- hanzo_mcp/tools/database/database_manager.py +77 -75
- hanzo_mcp/tools/database/graph.py +137 -91
- hanzo_mcp/tools/database/graph_add.py +30 -18
- hanzo_mcp/tools/database/graph_query.py +178 -102
- hanzo_mcp/tools/database/graph_remove.py +33 -28
- hanzo_mcp/tools/database/graph_search.py +97 -75
- hanzo_mcp/tools/database/graph_stats.py +91 -59
- hanzo_mcp/tools/database/sql.py +107 -79
- hanzo_mcp/tools/database/sql_query.py +30 -24
- hanzo_mcp/tools/database/sql_search.py +29 -25
- hanzo_mcp/tools/database/sql_stats.py +47 -35
- hanzo_mcp/tools/editor/neovim_command.py +25 -28
- hanzo_mcp/tools/editor/neovim_edit.py +21 -23
- hanzo_mcp/tools/editor/neovim_session.py +60 -54
- hanzo_mcp/tools/filesystem/__init__.py +31 -30
- hanzo_mcp/tools/filesystem/ast_multi_edit.py +329 -249
- hanzo_mcp/tools/filesystem/ast_tool.py +4 -4
- hanzo_mcp/tools/filesystem/base.py +1 -1
- hanzo_mcp/tools/filesystem/batch_search.py +316 -224
- hanzo_mcp/tools/filesystem/content_replace.py +4 -4
- hanzo_mcp/tools/filesystem/diff.py +71 -59
- hanzo_mcp/tools/filesystem/directory_tree.py +7 -7
- hanzo_mcp/tools/filesystem/directory_tree_paginated.py +49 -37
- hanzo_mcp/tools/filesystem/edit.py +4 -4
- hanzo_mcp/tools/filesystem/find.py +173 -80
- hanzo_mcp/tools/filesystem/find_files.py +73 -52
- hanzo_mcp/tools/filesystem/git_search.py +157 -104
- hanzo_mcp/tools/filesystem/grep.py +8 -8
- hanzo_mcp/tools/filesystem/multi_edit.py +4 -8
- hanzo_mcp/tools/filesystem/read.py +12 -10
- hanzo_mcp/tools/filesystem/rules_tool.py +59 -43
- hanzo_mcp/tools/filesystem/search_tool.py +263 -207
- hanzo_mcp/tools/filesystem/symbols_tool.py +94 -54
- hanzo_mcp/tools/filesystem/tree.py +35 -33
- hanzo_mcp/tools/filesystem/unix_aliases.py +13 -18
- hanzo_mcp/tools/filesystem/watch.py +37 -36
- hanzo_mcp/tools/filesystem/write.py +4 -8
- hanzo_mcp/tools/jupyter/__init__.py +4 -4
- hanzo_mcp/tools/jupyter/base.py +4 -5
- hanzo_mcp/tools/jupyter/jupyter.py +67 -47
- hanzo_mcp/tools/jupyter/notebook_edit.py +4 -4
- hanzo_mcp/tools/jupyter/notebook_read.py +4 -7
- hanzo_mcp/tools/llm/__init__.py +5 -7
- hanzo_mcp/tools/llm/consensus_tool.py +72 -52
- hanzo_mcp/tools/llm/llm_manage.py +101 -60
- hanzo_mcp/tools/llm/llm_tool.py +226 -166
- hanzo_mcp/tools/llm/provider_tools.py +25 -26
- hanzo_mcp/tools/lsp/__init__.py +1 -1
- hanzo_mcp/tools/lsp/lsp_tool.py +228 -143
- hanzo_mcp/tools/mcp/__init__.py +2 -3
- hanzo_mcp/tools/mcp/mcp_add.py +27 -25
- hanzo_mcp/tools/mcp/mcp_remove.py +7 -8
- hanzo_mcp/tools/mcp/mcp_stats.py +23 -22
- hanzo_mcp/tools/mcp/mcp_tool.py +129 -98
- hanzo_mcp/tools/memory/__init__.py +39 -21
- hanzo_mcp/tools/memory/knowledge_tools.py +124 -99
- hanzo_mcp/tools/memory/memory_tools.py +90 -108
- hanzo_mcp/tools/search/__init__.py +7 -2
- hanzo_mcp/tools/search/find_tool.py +297 -212
- hanzo_mcp/tools/search/unified_search.py +366 -314
- hanzo_mcp/tools/shell/__init__.py +8 -7
- hanzo_mcp/tools/shell/auto_background.py +56 -49
- hanzo_mcp/tools/shell/base.py +1 -1
- hanzo_mcp/tools/shell/base_process.py +75 -75
- hanzo_mcp/tools/shell/bash_session.py +2 -2
- hanzo_mcp/tools/shell/bash_session_executor.py +4 -4
- hanzo_mcp/tools/shell/bash_tool.py +24 -31
- hanzo_mcp/tools/shell/command_executor.py +12 -12
- hanzo_mcp/tools/shell/logs.py +43 -33
- hanzo_mcp/tools/shell/npx.py +13 -13
- hanzo_mcp/tools/shell/npx_background.py +24 -21
- hanzo_mcp/tools/shell/npx_tool.py +18 -22
- hanzo_mcp/tools/shell/open.py +19 -21
- hanzo_mcp/tools/shell/pkill.py +31 -26
- hanzo_mcp/tools/shell/process_tool.py +32 -32
- hanzo_mcp/tools/shell/processes.py +57 -58
- hanzo_mcp/tools/shell/run_background.py +24 -25
- hanzo_mcp/tools/shell/run_command.py +5 -5
- hanzo_mcp/tools/shell/run_command_windows.py +5 -5
- hanzo_mcp/tools/shell/session_storage.py +3 -3
- hanzo_mcp/tools/shell/streaming_command.py +141 -126
- hanzo_mcp/tools/shell/uvx.py +24 -25
- hanzo_mcp/tools/shell/uvx_background.py +35 -33
- hanzo_mcp/tools/shell/uvx_tool.py +18 -22
- hanzo_mcp/tools/todo/__init__.py +6 -2
- hanzo_mcp/tools/todo/todo.py +50 -37
- hanzo_mcp/tools/todo/todo_read.py +5 -8
- hanzo_mcp/tools/todo/todo_write.py +5 -7
- hanzo_mcp/tools/vector/__init__.py +40 -28
- hanzo_mcp/tools/vector/ast_analyzer.py +176 -143
- hanzo_mcp/tools/vector/git_ingester.py +170 -179
- hanzo_mcp/tools/vector/index_tool.py +96 -44
- hanzo_mcp/tools/vector/infinity_store.py +283 -228
- hanzo_mcp/tools/vector/mock_infinity.py +39 -40
- hanzo_mcp/tools/vector/project_manager.py +88 -78
- hanzo_mcp/tools/vector/vector.py +59 -42
- hanzo_mcp/tools/vector/vector_index.py +30 -27
- hanzo_mcp/tools/vector/vector_search.py +64 -45
- hanzo_mcp/types.py +6 -4
- {hanzo_mcp-0.7.6.dist-info → hanzo_mcp-0.8.0.dist-info}/METADATA +1 -1
- hanzo_mcp-0.8.0.dist-info/RECORD +185 -0
- hanzo_mcp-0.7.6.dist-info/RECORD +0 -182
- {hanzo_mcp-0.7.6.dist-info → hanzo_mcp-0.8.0.dist-info}/WHEEL +0 -0
- {hanzo_mcp-0.7.6.dist-info → hanzo_mcp-0.8.0.dist-info}/entry_points.txt +0 -0
- {hanzo_mcp-0.7.6.dist-info → hanzo_mcp-0.8.0.dist-info}/top_level.txt +0 -0
|
@@ -1,141 +1,399 @@
|
|
|
1
1
|
"""I Ching tool for creative problem solving using Hanzo principles."""
|
|
2
2
|
|
|
3
3
|
import random
|
|
4
|
-
from typing import Any, Dict, List, Optional, override
|
|
5
4
|
from enum import Enum
|
|
5
|
+
from typing import List, override
|
|
6
6
|
|
|
7
|
-
from hanzo_mcp.tools.common.base import BaseTool
|
|
8
|
-
from mcp.server.fastmcp import Context as MCPContext
|
|
9
7
|
from mcp.server import FastMCP
|
|
8
|
+
from mcp.server.fastmcp import Context as MCPContext
|
|
9
|
+
|
|
10
|
+
from hanzo_mcp.tools.common.base import BaseTool
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class HanzoPrinciple(Enum):
|
|
13
14
|
"""Hanzo principles organized by category."""
|
|
15
|
+
|
|
14
16
|
# Empathy
|
|
15
17
|
AUTONOMY = ("Autonomy", "Trust fully; freedom fuels genius", "🦅")
|
|
16
18
|
BALANCE = ("Balance", "Steady wins; burnout loses every time", "⚖️")
|
|
17
|
-
CUSTOMER_OBSESSION = (
|
|
19
|
+
CUSTOMER_OBSESSION = (
|
|
20
|
+
"Customer Obsession",
|
|
21
|
+
"Coach relentlessly; their victories yours",
|
|
22
|
+
"🎓",
|
|
23
|
+
)
|
|
18
24
|
HUMILITY = ("Humility", "Quiet confidence; greatness emerges naturally", "🧘")
|
|
19
25
|
INTEGRITY = ("Integrity", "Principles never break; reputation never fades", "🛡️")
|
|
20
26
|
SELFLESSNESS = ("Selflessness", "Elevate others; personal success follows", "🤝")
|
|
21
|
-
|
|
27
|
+
|
|
22
28
|
# Science
|
|
23
29
|
CURIOSITY = ("Curiosity", "Question always; truth never ends", "🌱")
|
|
24
30
|
EMPIRICISM = ("Empiricism", "Hypothesize, measure; reality defines truth", "🔬")
|
|
25
|
-
PRECISION = (
|
|
31
|
+
PRECISION = (
|
|
32
|
+
"Precision",
|
|
33
|
+
"Discipline in data; eliminate guesswork completely",
|
|
34
|
+
"🎯",
|
|
35
|
+
)
|
|
26
36
|
VALIDATION = ("Validation", "Test assumptions hard; illusions crumble fast", "✅")
|
|
27
37
|
OBJECTIVITY = ("Objectivity", "Ego out; results speak plainly", "🧊")
|
|
28
|
-
REPEATABILITY = (
|
|
29
|
-
|
|
38
|
+
REPEATABILITY = (
|
|
39
|
+
"Repeatability",
|
|
40
|
+
"Do it again; success repeats systematically",
|
|
41
|
+
"🔄",
|
|
42
|
+
)
|
|
43
|
+
|
|
30
44
|
# Design
|
|
31
|
-
ACCESSIBILITY = (
|
|
45
|
+
ACCESSIBILITY = (
|
|
46
|
+
"Accessibility",
|
|
47
|
+
"Open doors wide; adoption thrives naturally",
|
|
48
|
+
"🌐",
|
|
49
|
+
)
|
|
32
50
|
BEAUTY = ("Beauty", "Form speaks louder; aesthetics lift utility", "🎨")
|
|
33
51
|
CLARITY = ("Clarity", "Obvious is perfect; complexity hidden cleanly", "🔍")
|
|
34
52
|
CONSISTENCY = ("Consistency", "Uniform patterns; predictable results always", "🎯")
|
|
35
53
|
SIMPLICITY = ("Simplicity", "Cut ruthlessly; essential alone remains", "🪶")
|
|
36
54
|
FLOW = ("Flow", "Remove friction; natural motion prevails", "🌊")
|
|
37
|
-
|
|
55
|
+
|
|
38
56
|
# Engineering
|
|
39
|
-
BATTERIES_INCLUDED = (
|
|
57
|
+
BATTERIES_INCLUDED = (
|
|
58
|
+
"Batteries Included",
|
|
59
|
+
"Ready instantly; everything you need to start",
|
|
60
|
+
"🔋",
|
|
61
|
+
)
|
|
40
62
|
CONCURRENCY = ("Concurrency", "Parallel flows; frictionless scale", "⚡")
|
|
41
63
|
COMPOSABLE = ("Composable", "Modular magic; pieces multiply power", "🧩")
|
|
42
|
-
INTEROPERABLE = (
|
|
64
|
+
INTEROPERABLE = (
|
|
65
|
+
"Interoperable",
|
|
66
|
+
"Integrate effortlessly; value compounds infinitely",
|
|
67
|
+
"🔗",
|
|
68
|
+
)
|
|
43
69
|
ORTHOGONAL = ("Orthogonal", "Each tool exact; no overlap, no waste", "⚙️")
|
|
44
70
|
SCALABLE = ("Scalable", "Growth limitless; obstacles removed at inception", "📈")
|
|
45
|
-
|
|
71
|
+
|
|
46
72
|
# Scale
|
|
47
73
|
DISRUPTION = ("Disruption", "Reinvent boldly; transcend competition entirely", "💥")
|
|
48
74
|
EXPERIMENTATION = ("Experimentation", "Test quickly; iterate endlessly", "🧪")
|
|
49
75
|
EXPONENTIALITY = ("Exponentiality", "Compound constantly; incremental fades", "📈")
|
|
50
76
|
VELOCITY = ("Velocity", "Ship fast; refine faster", "🚀")
|
|
51
77
|
URGENCY = ("Urgency", "Act now; delays destroy opportunity", "⏱️")
|
|
52
|
-
|
|
78
|
+
|
|
53
79
|
# Wisdom
|
|
54
|
-
ADAPTABILITY = (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
80
|
+
ADAPTABILITY = (
|
|
81
|
+
"Adaptability",
|
|
82
|
+
"Pivot sharply; fluid response accelerates evolution",
|
|
83
|
+
"🌊",
|
|
84
|
+
)
|
|
85
|
+
DECENTRALIZATION = (
|
|
86
|
+
"Decentralization",
|
|
87
|
+
"Distribute power; resilience born from autonomy",
|
|
88
|
+
"🕸️",
|
|
89
|
+
)
|
|
90
|
+
FREEDOM = (
|
|
91
|
+
"Freedom",
|
|
92
|
+
"Democratize creativity; tools liberated, gatekeepers removed",
|
|
93
|
+
"🗽",
|
|
94
|
+
)
|
|
95
|
+
LONGEVITY = (
|
|
96
|
+
"Longevity",
|
|
97
|
+
"Build timelessly; greatness endures beyond lifetimes",
|
|
98
|
+
"⏳",
|
|
99
|
+
)
|
|
58
100
|
SECURITY = ("Security", "Encryption first; privacy non-negotiable", "🔐")
|
|
59
101
|
ZEN = ("Zen", "Calm mastery; effortless excellence every moment", "☯️")
|
|
60
102
|
|
|
61
103
|
|
|
62
104
|
class Hexagram:
|
|
63
105
|
"""I Ching hexagram with interpretation."""
|
|
64
|
-
|
|
106
|
+
|
|
65
107
|
HEXAGRAMS = {
|
|
66
|
-
"111111": (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"
|
|
108
|
+
"111111": (
|
|
109
|
+
"乾 (Qián)",
|
|
110
|
+
"Creative",
|
|
111
|
+
"Initiating force, pure yang energy. Time for bold action.",
|
|
112
|
+
),
|
|
113
|
+
"000000": (
|
|
114
|
+
"坤 (Kūn)",
|
|
115
|
+
"Receptive",
|
|
116
|
+
"Pure receptivity, yielding. Time to listen and adapt.",
|
|
117
|
+
),
|
|
118
|
+
"100010": (
|
|
119
|
+
"屯 (Zhūn)",
|
|
120
|
+
"Initial Difficulty",
|
|
121
|
+
"Growing pains. Persevere through early challenges.",
|
|
122
|
+
),
|
|
123
|
+
"010001": (
|
|
124
|
+
"蒙 (Méng)",
|
|
125
|
+
"Youthful Folly",
|
|
126
|
+
"Beginner's mind. Learn humbly, question assumptions.",
|
|
127
|
+
),
|
|
128
|
+
"111010": (
|
|
129
|
+
"需 (Xū)",
|
|
130
|
+
"Waiting",
|
|
131
|
+
"Strategic patience. Prepare while waiting for the right moment.",
|
|
132
|
+
),
|
|
133
|
+
"010111": (
|
|
134
|
+
"訟 (Sòng)",
|
|
135
|
+
"Conflict",
|
|
136
|
+
"Address conflicts directly but seek resolution, not victory.",
|
|
137
|
+
),
|
|
138
|
+
"010000": (
|
|
139
|
+
"師 (Shī)",
|
|
140
|
+
"Army",
|
|
141
|
+
"Organize resources, build strong teams, lead by example.",
|
|
142
|
+
),
|
|
143
|
+
"000010": (
|
|
144
|
+
"比 (Bǐ)",
|
|
145
|
+
"Holding Together",
|
|
146
|
+
"Unity and collaboration. Strengthen bonds.",
|
|
147
|
+
),
|
|
148
|
+
"111011": (
|
|
149
|
+
"小畜 (Xiǎo Chù)",
|
|
150
|
+
"Small Accumulation",
|
|
151
|
+
"Small consistent improvements compound over time.",
|
|
152
|
+
),
|
|
153
|
+
"110111": (
|
|
154
|
+
"履 (Lǚ)",
|
|
155
|
+
"Treading",
|
|
156
|
+
"Careful progress. Mind the details while moving forward.",
|
|
157
|
+
),
|
|
158
|
+
"111000": (
|
|
159
|
+
"泰 (Tài)",
|
|
160
|
+
"Peace",
|
|
161
|
+
"Harmony achieved. Maintain balance while building.",
|
|
162
|
+
),
|
|
163
|
+
"000111": (
|
|
164
|
+
"否 (Pǐ)",
|
|
165
|
+
"Standstill",
|
|
166
|
+
"Blockage present. Pause, reassess, find new paths.",
|
|
167
|
+
),
|
|
168
|
+
"101111": (
|
|
169
|
+
"同人 (Tóng Rén)",
|
|
170
|
+
"Fellowship",
|
|
171
|
+
"Community strength. Build alliances and share knowledge.",
|
|
172
|
+
),
|
|
173
|
+
"111101": (
|
|
174
|
+
"大有 (Dà Yǒu)",
|
|
175
|
+
"Great Possession",
|
|
176
|
+
"Abundance available. Share generously to multiply value.",
|
|
177
|
+
),
|
|
178
|
+
"001000": (
|
|
179
|
+
"謙 (Qiān)",
|
|
180
|
+
"Modesty",
|
|
181
|
+
"Humble confidence. Let work speak for itself.",
|
|
182
|
+
),
|
|
183
|
+
"000100": (
|
|
184
|
+
"豫 (Yù)",
|
|
185
|
+
"Enthusiasm",
|
|
186
|
+
"Infectious energy. Channel excitement into action.",
|
|
187
|
+
),
|
|
188
|
+
"100110": (
|
|
189
|
+
"隨 (Suí)",
|
|
190
|
+
"Following",
|
|
191
|
+
"Adaptive leadership. Know when to lead and when to follow.",
|
|
192
|
+
),
|
|
193
|
+
"011001": (
|
|
194
|
+
"蠱 (Gǔ)",
|
|
195
|
+
"Work on Decay",
|
|
196
|
+
"Fix technical debt. Address root causes.",
|
|
197
|
+
),
|
|
198
|
+
"110000": (
|
|
199
|
+
"臨 (Lín)",
|
|
200
|
+
"Approach",
|
|
201
|
+
"Opportunity approaching. Prepare to receive it.",
|
|
202
|
+
),
|
|
203
|
+
"000011": (
|
|
204
|
+
"觀 (Guān)",
|
|
205
|
+
"Contemplation",
|
|
206
|
+
"Step back for perspective. See the whole system.",
|
|
207
|
+
),
|
|
208
|
+
"100101": (
|
|
209
|
+
"噬嗑 (Shì Kè)",
|
|
210
|
+
"Biting Through",
|
|
211
|
+
"Remove obstacles decisively. Clear blockages.",
|
|
212
|
+
),
|
|
87
213
|
"101001": ("賁 (Bì)", "Grace", "Polish and refine. Beauty enhances function."),
|
|
88
|
-
"000001": (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
214
|
+
"000001": (
|
|
215
|
+
"剝 (Bō)",
|
|
216
|
+
"Splitting Apart",
|
|
217
|
+
"Decay phase. Let go of what's not working.",
|
|
218
|
+
),
|
|
219
|
+
"100000": (
|
|
220
|
+
"復 (Fù)",
|
|
221
|
+
"Return",
|
|
222
|
+
"New cycle begins. Start fresh with lessons learned.",
|
|
223
|
+
),
|
|
224
|
+
"100111": (
|
|
225
|
+
"無妄 (Wú Wàng)",
|
|
226
|
+
"Innocence",
|
|
227
|
+
"Act with pure intention. Avoid overthinking.",
|
|
228
|
+
),
|
|
229
|
+
"111001": (
|
|
230
|
+
"大畜 (Dà Chù)",
|
|
231
|
+
"Great Accumulation",
|
|
232
|
+
"Build reserves. Invest in infrastructure.",
|
|
233
|
+
),
|
|
234
|
+
"100001": (
|
|
235
|
+
"頤 (Yí)",
|
|
236
|
+
"Nourishment",
|
|
237
|
+
"Feed growth. Provide resources teams need.",
|
|
238
|
+
),
|
|
239
|
+
"011110": (
|
|
240
|
+
"大過 (Dà Guò)",
|
|
241
|
+
"Great Excess",
|
|
242
|
+
"Extraordinary measures needed. Bold action required.",
|
|
243
|
+
),
|
|
244
|
+
"010010": (
|
|
245
|
+
"坎 (Kǎn)",
|
|
246
|
+
"Abysmal",
|
|
247
|
+
"Navigate danger carefully. Trust your training.",
|
|
248
|
+
),
|
|
249
|
+
"101101": (
|
|
250
|
+
"離 (Lí)",
|
|
251
|
+
"Clinging Fire",
|
|
252
|
+
"Clarity and vision. Illuminate the path forward.",
|
|
253
|
+
),
|
|
254
|
+
"001110": (
|
|
255
|
+
"咸 (Xián)",
|
|
256
|
+
"Influence",
|
|
257
|
+
"Mutual attraction. Build on natural affinities.",
|
|
258
|
+
),
|
|
259
|
+
"011100": (
|
|
260
|
+
"恆 (Héng)",
|
|
261
|
+
"Duration",
|
|
262
|
+
"Persistence pays. Maintain steady effort.",
|
|
263
|
+
),
|
|
98
264
|
"001111": ("遯 (Dùn)", "Retreat", "Strategic withdrawal. Regroup and refocus."),
|
|
99
|
-
"111100": (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"
|
|
105
|
-
|
|
265
|
+
"111100": (
|
|
266
|
+
"大壯 (Dà Zhuàng)",
|
|
267
|
+
"Great Power",
|
|
268
|
+
"Strength available. Use power responsibly.",
|
|
269
|
+
),
|
|
270
|
+
"000101": (
|
|
271
|
+
"晉 (Jìn)",
|
|
272
|
+
"Progress",
|
|
273
|
+
"Advance steadily. Each step builds momentum.",
|
|
274
|
+
),
|
|
275
|
+
"101000": (
|
|
276
|
+
"明夷 (Míng Yí)",
|
|
277
|
+
"Darkening Light",
|
|
278
|
+
"Work quietly. Keep brilliance hidden for now.",
|
|
279
|
+
),
|
|
280
|
+
"101011": (
|
|
281
|
+
"家人 (Jiā Rén)",
|
|
282
|
+
"Family",
|
|
283
|
+
"Team harmony. Strengthen internal culture.",
|
|
284
|
+
),
|
|
285
|
+
"110101": (
|
|
286
|
+
"睽 (Kuí)",
|
|
287
|
+
"Opposition",
|
|
288
|
+
"Creative tension. Find synthesis in differences.",
|
|
289
|
+
),
|
|
290
|
+
"001010": (
|
|
291
|
+
"蹇 (Jiǎn)",
|
|
292
|
+
"Obstruction",
|
|
293
|
+
"Difficulty ahead. Find alternative routes.",
|
|
294
|
+
),
|
|
295
|
+
"010100": (
|
|
296
|
+
"解 (Xiè)",
|
|
297
|
+
"Deliverance",
|
|
298
|
+
"Breakthrough achieved. Consolidate gains.",
|
|
299
|
+
),
|
|
106
300
|
"110001": ("損 (Sǔn)", "Decrease", "Simplify ruthlessly. Less is more."),
|
|
107
301
|
"100011": ("益 (Yì)", "Increase", "Multiply value. Invest in growth."),
|
|
108
|
-
"111110": (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
302
|
+
"111110": (
|
|
303
|
+
"夬 (Guài)",
|
|
304
|
+
"Breakthrough",
|
|
305
|
+
"Decisive moment. Act with conviction.",
|
|
306
|
+
),
|
|
307
|
+
"011111": (
|
|
308
|
+
"姤 (Gòu)",
|
|
309
|
+
"Coming to Meet",
|
|
310
|
+
"Unexpected encounter. Stay alert to opportunity.",
|
|
311
|
+
),
|
|
312
|
+
"000110": (
|
|
313
|
+
"萃 (Cuì)",
|
|
314
|
+
"Gathering",
|
|
315
|
+
"Convergence point. Bring elements together.",
|
|
316
|
+
),
|
|
317
|
+
"011000": (
|
|
318
|
+
"升 (Shēng)",
|
|
319
|
+
"Pushing Upward",
|
|
320
|
+
"Gradual ascent. Build systematically.",
|
|
321
|
+
),
|
|
112
322
|
"010110": ("困 (Kùn)", "Exhaustion", "Resources depleted. Rest and recharge."),
|
|
113
323
|
"011010": ("井 (Jǐng)", "The Well", "Deep resources. Draw from fundamentals."),
|
|
114
|
-
"101110": (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"
|
|
324
|
+
"101110": (
|
|
325
|
+
"革 (Gé)",
|
|
326
|
+
"Revolution",
|
|
327
|
+
"Transform completely. Embrace radical change.",
|
|
328
|
+
),
|
|
329
|
+
"011101": (
|
|
330
|
+
"鼎 (Dǐng)",
|
|
331
|
+
"The Cauldron",
|
|
332
|
+
"Transformation vessel. Cook new solutions.",
|
|
333
|
+
),
|
|
334
|
+
"100100": (
|
|
335
|
+
"震 (Zhèn)",
|
|
336
|
+
"Thunder",
|
|
337
|
+
"Shocking awakening. Respond to wake-up calls.",
|
|
338
|
+
),
|
|
339
|
+
"001001": (
|
|
340
|
+
"艮 (Gèn)",
|
|
341
|
+
"Mountain",
|
|
342
|
+
"Stillness and stability. Find solid ground.",
|
|
343
|
+
),
|
|
344
|
+
"001011": (
|
|
345
|
+
"漸 (Jiàn)",
|
|
346
|
+
"Gradual Progress",
|
|
347
|
+
"Step by step. Patient development.",
|
|
348
|
+
),
|
|
349
|
+
"110100": (
|
|
350
|
+
"歸妹 (Guī Mèi)",
|
|
351
|
+
"Marrying Maiden",
|
|
352
|
+
"New partnerships. Align expectations.",
|
|
353
|
+
),
|
|
120
354
|
"101100": ("豐 (Fēng)", "Abundance", "Peak achievement. Prepare for cycles."),
|
|
121
355
|
"001101": ("旅 (Lǚ)", "The Wanderer", "Explorer mindset. Learn from journey."),
|
|
122
|
-
"011011": (
|
|
356
|
+
"011011": (
|
|
357
|
+
"巽 (Xùn)",
|
|
358
|
+
"Gentle Wind",
|
|
359
|
+
"Subtle influence. Persistent gentle pressure.",
|
|
360
|
+
),
|
|
123
361
|
"110110": ("兌 (Duì)", "Joy", "Infectious happiness. Celebrate progress."),
|
|
124
362
|
"010011": ("渙 (Huàn)", "Dispersion", "Break up rigidity. Dissolve barriers."),
|
|
125
|
-
"110010": (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
363
|
+
"110010": (
|
|
364
|
+
"節 (Jié)",
|
|
365
|
+
"Limitation",
|
|
366
|
+
"Healthy constraints. Focus through limits.",
|
|
367
|
+
),
|
|
368
|
+
"110011": (
|
|
369
|
+
"中孚 (Zhōng Fú)",
|
|
370
|
+
"Inner Truth",
|
|
371
|
+
"Authentic core. Build from truth.",
|
|
372
|
+
),
|
|
373
|
+
"001100": (
|
|
374
|
+
"小過 (Xiǎo Guò)",
|
|
375
|
+
"Small Excess",
|
|
376
|
+
"Minor adjustments. Fine-tune carefully.",
|
|
377
|
+
),
|
|
378
|
+
"101010": (
|
|
379
|
+
"既濟 (Jì Jì)",
|
|
380
|
+
"After Completion",
|
|
381
|
+
"Success achieved. Maintain vigilance.",
|
|
382
|
+
),
|
|
383
|
+
"010101": (
|
|
384
|
+
"未濟 (Wèi Jì)",
|
|
385
|
+
"Before Completion",
|
|
386
|
+
"Almost there. Final push needed.",
|
|
387
|
+
),
|
|
130
388
|
}
|
|
131
|
-
|
|
389
|
+
|
|
132
390
|
def __init__(self, lines: str):
|
|
133
391
|
self.lines = lines
|
|
134
392
|
self.name, self.title, self.meaning = self.HEXAGRAMS.get(
|
|
135
|
-
lines,
|
|
136
|
-
("Unknown", "Mystery", "The pattern is unclear. Trust your intuition.")
|
|
393
|
+
lines,
|
|
394
|
+
("Unknown", "Mystery", "The pattern is unclear. Trust your intuition."),
|
|
137
395
|
)
|
|
138
|
-
|
|
396
|
+
|
|
139
397
|
def get_changing_lines(self) -> List[int]:
|
|
140
398
|
"""Identify which lines are changing (would be 6 or 9 in traditional I Ching)."""
|
|
141
399
|
# For simplicity, randomly select 0-2 changing lines
|
|
@@ -148,10 +406,10 @@ class Hexagram:
|
|
|
148
406
|
|
|
149
407
|
class IChing:
|
|
150
408
|
"""I Ching oracle for engineering guidance."""
|
|
151
|
-
|
|
409
|
+
|
|
152
410
|
def __init__(self):
|
|
153
411
|
self.principles = list(HanzoPrinciple)
|
|
154
|
-
|
|
412
|
+
|
|
155
413
|
def cast_hexagram(self) -> Hexagram:
|
|
156
414
|
"""Cast a hexagram using virtual coins."""
|
|
157
415
|
lines = ""
|
|
@@ -164,16 +422,20 @@ class IChing:
|
|
|
164
422
|
else:
|
|
165
423
|
lines += "1"
|
|
166
424
|
return Hexagram(lines)
|
|
167
|
-
|
|
168
|
-
def select_principles(
|
|
425
|
+
|
|
426
|
+
def select_principles(
|
|
427
|
+
self, hexagram: Hexagram, challenge: str
|
|
428
|
+
) -> List[HanzoPrinciple]:
|
|
169
429
|
"""Select relevant Hanzo principles based on hexagram and challenge."""
|
|
170
430
|
# Use hexagram pattern to deterministically but creatively select principles
|
|
171
431
|
selected = []
|
|
172
|
-
|
|
432
|
+
|
|
173
433
|
# Primary principle based on hexagram pattern
|
|
174
|
-
primary_index = sum(
|
|
434
|
+
primary_index = sum(
|
|
435
|
+
int(bit) * (2**i) for i, bit in enumerate(hexagram.lines)
|
|
436
|
+
) % len(self.principles)
|
|
175
437
|
selected.append(self.principles[primary_index])
|
|
176
|
-
|
|
438
|
+
|
|
177
439
|
# Supporting principles based on challenge keywords
|
|
178
440
|
keywords = challenge.lower().split()
|
|
179
441
|
keyword_matches = {
|
|
@@ -188,17 +450,19 @@ class IChing:
|
|
|
188
450
|
"performance": [HanzoPrinciple.CONCURRENCY, HanzoPrinciple.ORTHOGONAL],
|
|
189
451
|
"user": [HanzoPrinciple.CUSTOMER_OBSESSION, HanzoPrinciple.ACCESSIBILITY],
|
|
190
452
|
}
|
|
191
|
-
|
|
453
|
+
|
|
192
454
|
for keyword, principles in keyword_matches.items():
|
|
193
455
|
if keyword in keywords:
|
|
194
456
|
selected.extend(principles)
|
|
195
|
-
|
|
457
|
+
|
|
196
458
|
# Add complementary principle based on changing lines
|
|
197
459
|
changing_lines = hexagram.get_changing_lines()
|
|
198
460
|
if changing_lines:
|
|
199
|
-
complement_index = (primary_index + sum(changing_lines)) % len(
|
|
461
|
+
complement_index = (primary_index + sum(changing_lines)) % len(
|
|
462
|
+
self.principles
|
|
463
|
+
)
|
|
200
464
|
selected.append(self.principles[complement_index])
|
|
201
|
-
|
|
465
|
+
|
|
202
466
|
# Ensure uniqueness and limit to 3-5 principles
|
|
203
467
|
seen = set()
|
|
204
468
|
unique_selected = []
|
|
@@ -206,47 +470,50 @@ class IChing:
|
|
|
206
470
|
if principle not in seen:
|
|
207
471
|
seen.add(principle)
|
|
208
472
|
unique_selected.append(principle)
|
|
209
|
-
|
|
473
|
+
|
|
210
474
|
return unique_selected[:5]
|
|
211
|
-
|
|
475
|
+
|
|
212
476
|
def generate_guidance(
|
|
213
|
-
self,
|
|
214
|
-
hexagram: Hexagram,
|
|
215
|
-
principles: List[HanzoPrinciple],
|
|
216
|
-
challenge: str
|
|
477
|
+
self, hexagram: Hexagram, principles: List[HanzoPrinciple], challenge: str
|
|
217
478
|
) -> str:
|
|
218
479
|
"""Generate creative guidance combining I Ching wisdom and Hanzo principles."""
|
|
219
480
|
guidance = f"☯️ I CHING GUIDANCE FOR ENGINEERING CHALLENGE ☯️\n\n"
|
|
220
481
|
guidance += f"**Your Challenge:** {challenge}\n\n"
|
|
221
|
-
|
|
482
|
+
|
|
222
483
|
guidance += f"**Hexagram Cast:** {hexagram.name} - {hexagram.title}\n"
|
|
223
484
|
guidance += f"**Pattern:** {''.join('━━━' if l == '1' else '━ ━' for l in hexagram.lines[::-1])}\n"
|
|
224
485
|
guidance += f"**Ancient Wisdom:** {hexagram.meaning}\n\n"
|
|
225
|
-
|
|
486
|
+
|
|
226
487
|
guidance += "**Hanzo Principles to Apply:**\n\n"
|
|
227
|
-
|
|
488
|
+
|
|
228
489
|
for principle in principles:
|
|
229
490
|
name, wisdom, emoji = principle.value
|
|
230
491
|
guidance += f"{emoji} **{name}**\n"
|
|
231
492
|
guidance += f" *{wisdom}*\n\n"
|
|
232
|
-
|
|
493
|
+
|
|
233
494
|
# Generate specific actionable advice
|
|
234
495
|
guidance += "**Synthesized Approach:**\n\n"
|
|
235
|
-
|
|
496
|
+
|
|
236
497
|
# Hexagram-specific guidance
|
|
237
498
|
if "Creative" in hexagram.title:
|
|
238
499
|
guidance += "• This is a time for bold innovation. Don't hold back on ambitious ideas.\n"
|
|
239
500
|
elif "Receptive" in hexagram.title:
|
|
240
|
-
guidance +=
|
|
501
|
+
guidance += (
|
|
502
|
+
"• Listen deeply to user needs and system constraints before acting.\n"
|
|
503
|
+
)
|
|
241
504
|
elif "Difficulty" in hexagram.title:
|
|
242
|
-
guidance +=
|
|
505
|
+
guidance += (
|
|
506
|
+
"• Challenges are teachers. Each obstacle reveals the path forward.\n"
|
|
507
|
+
)
|
|
243
508
|
elif "Waiting" in hexagram.title:
|
|
244
509
|
guidance += "• Strategic patience required. Prepare thoroughly before implementation.\n"
|
|
245
510
|
elif "Conflict" in hexagram.title:
|
|
246
511
|
guidance += "• Technical disagreements? Seek data-driven resolution.\n"
|
|
247
512
|
elif "Peace" in hexagram.title:
|
|
248
|
-
guidance +=
|
|
249
|
-
|
|
513
|
+
guidance += (
|
|
514
|
+
"• Harmony achieved. Now build sustainably on this foundation.\n"
|
|
515
|
+
)
|
|
516
|
+
|
|
250
517
|
# Principle-specific actionable advice
|
|
251
518
|
principle_actions = {
|
|
252
519
|
HanzoPrinciple.SCALABLE: "• Design for 10x growth from day one. Remove scaling bottlenecks now.",
|
|
@@ -258,49 +525,54 @@ class IChing:
|
|
|
258
525
|
HanzoPrinciple.SECURITY: "• Security is not optional. Encrypt by default.",
|
|
259
526
|
HanzoPrinciple.ZEN: "• Find calm in the chaos. Clear mind writes better code.",
|
|
260
527
|
}
|
|
261
|
-
|
|
528
|
+
|
|
262
529
|
for principle in principles:
|
|
263
530
|
if principle in principle_actions:
|
|
264
531
|
guidance += principle_actions[principle] + "\n"
|
|
265
|
-
|
|
532
|
+
|
|
266
533
|
# Changing lines wisdom
|
|
267
534
|
changing_lines = hexagram.get_changing_lines()
|
|
268
535
|
if changing_lines:
|
|
269
|
-
guidance += f"\n**Lines in Transition:** {', '.join(str(i+1) for i in changing_lines)}\n"
|
|
270
|
-
guidance +=
|
|
271
|
-
|
|
536
|
+
guidance += f"\n**Lines in Transition:** {', '.join(str(i + 1) for i in changing_lines)}\n"
|
|
537
|
+
guidance += (
|
|
538
|
+
"• Change is imminent in these areas. Prepare for transformation.\n"
|
|
539
|
+
)
|
|
540
|
+
|
|
272
541
|
# Final synthesis
|
|
273
542
|
guidance += "\n**The Way Forward:**\n"
|
|
274
543
|
guidance += self._synthesize_action_plan(hexagram, principles, challenge)
|
|
275
|
-
|
|
544
|
+
|
|
276
545
|
guidance += "\n\n*Remember: The I Ching reveals patterns, not prescriptions. "
|
|
277
546
|
guidance += "Let this wisdom guide your intuition as you craft your solution.*"
|
|
278
|
-
|
|
547
|
+
|
|
279
548
|
return guidance
|
|
280
|
-
|
|
549
|
+
|
|
281
550
|
def _synthesize_action_plan(
|
|
282
|
-
self,
|
|
283
|
-
hexagram: Hexagram,
|
|
284
|
-
principles: List[HanzoPrinciple],
|
|
285
|
-
challenge: str
|
|
551
|
+
self, hexagram: Hexagram, principles: List[HanzoPrinciple], challenge: str
|
|
286
552
|
) -> str:
|
|
287
553
|
"""Create a specific action plan based on the reading."""
|
|
288
554
|
plan = ""
|
|
289
|
-
|
|
555
|
+
|
|
290
556
|
# Determine the nature of the challenge
|
|
291
557
|
if any(word in challenge.lower() for word in ["bug", "error", "fix", "broken"]):
|
|
292
558
|
plan += "1. **Diagnose systematically** - Use empirical debugging, not guesswork\n"
|
|
293
559
|
plan += "2. **Fix root cause** - Address the source, not just symptoms\n"
|
|
294
560
|
plan += "3. **Prevent recurrence** - Add tests and monitoring\n"
|
|
295
|
-
elif any(
|
|
561
|
+
elif any(
|
|
562
|
+
word in challenge.lower() for word in ["scale", "performance", "slow"]
|
|
563
|
+
):
|
|
296
564
|
plan += "1. **Measure first** - Profile to find actual bottlenecks\n"
|
|
297
565
|
plan += "2. **Parallelize** - Use concurrency where possible\n"
|
|
298
566
|
plan += "3. **Simplify** - Remove complexity before optimizing\n"
|
|
299
|
-
elif any(
|
|
567
|
+
elif any(
|
|
568
|
+
word in challenge.lower() for word in ["design", "architect", "structure"]
|
|
569
|
+
):
|
|
300
570
|
plan += "1. **Start simple** - MVP first, elaborate later\n"
|
|
301
571
|
plan += "2. **Stay flexible** - Design for change\n"
|
|
302
572
|
plan += "3. **Think holistically** - Consider entire system\n"
|
|
303
|
-
elif any(
|
|
573
|
+
elif any(
|
|
574
|
+
word in challenge.lower() for word in ["team", "collaborate", "people"]
|
|
575
|
+
):
|
|
304
576
|
plan += "1. **Enable autonomy** - Trust your team\n"
|
|
305
577
|
plan += "2. **Maintain balance** - Sustainable pace wins\n"
|
|
306
578
|
plan += "3. **Share knowledge** - Elevate everyone\n"
|
|
@@ -308,15 +580,15 @@ class IChing:
|
|
|
308
580
|
plan += "1. **Clarify intent** - What problem are you really solving?\n"
|
|
309
581
|
plan += "2. **Start small** - Build incrementally\n"
|
|
310
582
|
plan += "3. **Iterate rapidly** - Fast feedback loops\n"
|
|
311
|
-
|
|
583
|
+
|
|
312
584
|
return plan
|
|
313
585
|
|
|
314
586
|
|
|
315
587
|
class IChingTool(BaseTool):
|
|
316
588
|
"""Tool for applying I Ching wisdom to engineering challenges."""
|
|
317
|
-
|
|
589
|
+
|
|
318
590
|
name = "iching"
|
|
319
|
-
|
|
591
|
+
|
|
320
592
|
@property
|
|
321
593
|
@override
|
|
322
594
|
def description(self) -> str:
|
|
@@ -345,36 +617,29 @@ Use this when you need:
|
|
|
345
617
|
- Creative approach to challenges
|
|
346
618
|
- Wisdom for difficult decisions
|
|
347
619
|
- Alignment with Hanzo principles"""
|
|
348
|
-
|
|
620
|
+
|
|
349
621
|
def __init__(self):
|
|
350
622
|
"""Initialize the I Ching tool."""
|
|
351
623
|
super().__init__()
|
|
352
624
|
self.oracle = IChing()
|
|
353
|
-
|
|
354
|
-
async def call(
|
|
355
|
-
self,
|
|
356
|
-
ctx: MCPContext,
|
|
357
|
-
challenge: str
|
|
358
|
-
) -> str:
|
|
625
|
+
|
|
626
|
+
async def call(self, ctx: MCPContext, challenge: str) -> str:
|
|
359
627
|
"""Cast I Ching and provide guidance."""
|
|
360
628
|
# Cast hexagram
|
|
361
629
|
hexagram = self.oracle.cast_hexagram()
|
|
362
|
-
|
|
630
|
+
|
|
363
631
|
# Select relevant principles
|
|
364
632
|
principles = self.oracle.select_principles(hexagram, challenge)
|
|
365
|
-
|
|
633
|
+
|
|
366
634
|
# Generate guidance
|
|
367
635
|
guidance = self.oracle.generate_guidance(hexagram, principles, challenge)
|
|
368
|
-
|
|
636
|
+
|
|
369
637
|
return guidance
|
|
370
|
-
|
|
638
|
+
|
|
371
639
|
def register(self, server: FastMCP) -> None:
|
|
372
640
|
"""Register the tool with the MCP server."""
|
|
373
641
|
tool_self = self
|
|
374
|
-
|
|
642
|
+
|
|
375
643
|
@server.tool(name=self.name, description=self.description)
|
|
376
|
-
async def iching(
|
|
377
|
-
ctx
|
|
378
|
-
challenge: str
|
|
379
|
-
) -> str:
|
|
380
|
-
return await tool_self.call(ctx, challenge)
|
|
644
|
+
async def iching(ctx: MCPContext, challenge: str) -> str:
|
|
645
|
+
return await tool_self.call(ctx, challenge)
|