fast-agent-mcp 0.2.36__py3-none-any.whl → 0.2.38__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 fast-agent-mcp might be problematic. Click here for more details.

Files changed (63) hide show
  1. {fast_agent_mcp-0.2.36.dist-info → fast_agent_mcp-0.2.38.dist-info}/METADATA +10 -7
  2. {fast_agent_mcp-0.2.36.dist-info → fast_agent_mcp-0.2.38.dist-info}/RECORD +45 -47
  3. {fast_agent_mcp-0.2.36.dist-info → fast_agent_mcp-0.2.38.dist-info}/licenses/LICENSE +1 -1
  4. mcp_agent/cli/commands/quickstart.py +60 -5
  5. mcp_agent/config.py +10 -0
  6. mcp_agent/context.py +1 -4
  7. mcp_agent/core/agent_types.py +7 -6
  8. mcp_agent/core/direct_decorators.py +14 -0
  9. mcp_agent/core/direct_factory.py +1 -0
  10. mcp_agent/core/fastagent.py +23 -2
  11. mcp_agent/human_input/elicitation_form.py +723 -0
  12. mcp_agent/human_input/elicitation_forms.py +59 -0
  13. mcp_agent/human_input/elicitation_handler.py +88 -0
  14. mcp_agent/human_input/elicitation_state.py +34 -0
  15. mcp_agent/llm/providers/augmented_llm_google_native.py +4 -2
  16. mcp_agent/llm/providers/augmented_llm_openai.py +1 -1
  17. mcp_agent/mcp/elicitation_factory.py +84 -0
  18. mcp_agent/mcp/elicitation_handlers.py +155 -0
  19. mcp_agent/mcp/helpers/content_helpers.py +27 -0
  20. mcp_agent/mcp/helpers/server_config_helpers.py +10 -8
  21. mcp_agent/mcp/mcp_agent_client_session.py +44 -1
  22. mcp_agent/mcp/mcp_aggregator.py +56 -11
  23. mcp_agent/mcp/mcp_connection_manager.py +30 -18
  24. mcp_agent/mcp_server/agent_server.py +2 -0
  25. mcp_agent/mcp_server_registry.py +16 -8
  26. mcp_agent/resources/examples/data-analysis/analysis.py +1 -2
  27. mcp_agent/resources/examples/mcp/elicitations/elicitation_account_server.py +88 -0
  28. mcp_agent/resources/examples/mcp/elicitations/elicitation_forms_server.py +232 -0
  29. mcp_agent/resources/examples/mcp/elicitations/elicitation_game_server.py +164 -0
  30. mcp_agent/resources/examples/mcp/elicitations/fastagent.config.yaml +35 -0
  31. mcp_agent/resources/examples/mcp/elicitations/fastagent.secrets.yaml.example +17 -0
  32. mcp_agent/resources/examples/mcp/elicitations/forms_demo.py +111 -0
  33. mcp_agent/resources/examples/mcp/elicitations/game_character.py +65 -0
  34. mcp_agent/resources/examples/mcp/elicitations/game_character_handler.py +256 -0
  35. mcp_agent/resources/examples/{prompting/agent.py → mcp/elicitations/tool_call.py} +4 -5
  36. mcp_agent/resources/examples/mcp/state-transfer/agent_two.py +1 -1
  37. mcp_agent/resources/examples/mcp/state-transfer/fastagent.config.yaml +1 -1
  38. mcp_agent/resources/examples/mcp/state-transfer/fastagent.secrets.yaml.example +1 -0
  39. mcp_agent/resources/examples/workflows/evaluator.py +1 -1
  40. mcp_agent/resources/examples/workflows/graded_report.md +89 -0
  41. mcp_agent/resources/examples/workflows/orchestrator.py +7 -9
  42. mcp_agent/resources/examples/workflows/parallel.py +0 -2
  43. mcp_agent/resources/examples/workflows/short_story.md +13 -0
  44. mcp_agent/resources/examples/in_dev/agent_build.py +0 -84
  45. mcp_agent/resources/examples/in_dev/css-LICENSE.txt +0 -21
  46. mcp_agent/resources/examples/in_dev/slides.py +0 -110
  47. mcp_agent/resources/examples/internal/agent.py +0 -20
  48. mcp_agent/resources/examples/internal/fastagent.config.yaml +0 -66
  49. mcp_agent/resources/examples/internal/history_transfer.py +0 -35
  50. mcp_agent/resources/examples/internal/job.py +0 -84
  51. mcp_agent/resources/examples/internal/prompt_category.py +0 -21
  52. mcp_agent/resources/examples/internal/prompt_sizing.py +0 -51
  53. mcp_agent/resources/examples/internal/simple.txt +0 -2
  54. mcp_agent/resources/examples/internal/sizer.py +0 -20
  55. mcp_agent/resources/examples/internal/social.py +0 -67
  56. mcp_agent/resources/examples/prompting/__init__.py +0 -3
  57. mcp_agent/resources/examples/prompting/delimited_prompt.txt +0 -14
  58. mcp_agent/resources/examples/prompting/fastagent.config.yaml +0 -43
  59. mcp_agent/resources/examples/prompting/image_server.py +0 -52
  60. mcp_agent/resources/examples/prompting/prompt1.txt +0 -6
  61. mcp_agent/resources/examples/prompting/work_with_image.py +0 -19
  62. {fast_agent_mcp-0.2.36.dist-info → fast_agent_mcp-0.2.38.dist-info}/WHEEL +0 -0
  63. {fast_agent_mcp-0.2.36.dist-info → fast_agent_mcp-0.2.38.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,164 @@
1
+ """
2
+ MCP Server for Game Character Creation
3
+
4
+ This server provides a fun game character creation form
5
+ that can be used with custom handlers.
6
+ """
7
+
8
+ import logging
9
+ import random
10
+ import sys
11
+
12
+ from mcp import ReadResourceResult
13
+ from mcp.server.elicitation import (
14
+ AcceptedElicitation,
15
+ CancelledElicitation,
16
+ DeclinedElicitation,
17
+ )
18
+ from mcp.server.fastmcp import FastMCP
19
+ from mcp.types import TextResourceContents
20
+ from pydantic import AnyUrl, BaseModel, Field
21
+
22
+ # Configure logging
23
+ logging.basicConfig(
24
+ level=logging.INFO,
25
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
26
+ stream=sys.stderr,
27
+ )
28
+ logger = logging.getLogger("elicitation_game_server")
29
+
30
+ # Create MCP server
31
+ mcp = FastMCP("Game Character Creation Server", log_level="INFO")
32
+
33
+
34
+ @mcp.resource(uri="elicitation://game-character")
35
+ async def game_character() -> ReadResourceResult:
36
+ """Fun game character creation form for the whimsical example."""
37
+
38
+ class GameCharacter(BaseModel):
39
+ character_name: str = Field(description="Name your character", min_length=2, max_length=30)
40
+ character_class: str = Field(
41
+ description="Choose your class",
42
+ json_schema_extra={
43
+ "enum": ["warrior", "mage", "rogue", "ranger", "paladin", "bard"],
44
+ "enumNames": [
45
+ "⚔️ Warrior",
46
+ "🔮 Mage",
47
+ "🗡️ Rogue",
48
+ "🏹 Ranger",
49
+ "🛡️ Paladin",
50
+ "🎵 Bard",
51
+ ],
52
+ },
53
+ )
54
+ strength: int = Field(description="Strength (3-18)", ge=3, le=18, default=10)
55
+ intelligence: int = Field(description="Intelligence (3-18)", ge=3, le=18, default=10)
56
+ dexterity: int = Field(description="Dexterity (3-18)", ge=3, le=18, default=10)
57
+ charisma: int = Field(description="Charisma (3-18)", ge=3, le=18, default=10)
58
+ lucky_dice: bool = Field(False, description="Roll for a lucky bonus?")
59
+
60
+ result = await mcp.get_context().elicit("🎮 Create Your Game Character!", schema=GameCharacter)
61
+
62
+ match result:
63
+ case AcceptedElicitation(data=data):
64
+ lines = [
65
+ f"🎭 Character Created: {data.character_name}",
66
+ f"Class: {data.character_class.title()}",
67
+ f"Stats: STR:{data.strength} INT:{data.intelligence} DEX:{data.dexterity} CHA:{data.charisma}",
68
+ ]
69
+
70
+ if data.lucky_dice:
71
+ dice_roll = random.randint(1, 20)
72
+ if dice_roll >= 15:
73
+ bonus = random.choice(
74
+ [
75
+ "🎁 Lucky! +2 to all stats!",
76
+ "🌟 Critical! Found a magic item!",
77
+ "💰 Jackpot! +100 gold!",
78
+ ]
79
+ )
80
+ lines.append(f"🎲 Dice Roll: {dice_roll} - {bonus}")
81
+ else:
82
+ lines.append(f"🎲 Dice Roll: {dice_roll} - No bonus this time!")
83
+
84
+ total_stats = data.strength + data.intelligence + data.dexterity + data.charisma
85
+ if total_stats > 50:
86
+ lines.append("💪 Powerful character build!")
87
+ elif total_stats < 30:
88
+ lines.append("🎯 Challenging build - good luck!")
89
+
90
+ response = "\n".join(lines)
91
+ case DeclinedElicitation():
92
+ response = "Character creation declined - returning to menu"
93
+ case CancelledElicitation():
94
+ response = "Character creation cancelled"
95
+
96
+ return ReadResourceResult(
97
+ contents=[
98
+ TextResourceContents(
99
+ mimeType="text/plain", uri=AnyUrl("elicitation://game-character"), text=response
100
+ )
101
+ ]
102
+ )
103
+
104
+
105
+ @mcp.tool()
106
+ async def roll_new_character(campaign_name: str = "Adventure") -> str:
107
+ """
108
+ Roll a new character for your campaign.
109
+
110
+ Args:
111
+ campaign_name: The name of the campaign
112
+
113
+ Returns:
114
+ Character details or status message
115
+ """
116
+
117
+ class GameCharacter(BaseModel):
118
+ character_name: str = Field(description="Name your character", min_length=2, max_length=30)
119
+ character_class: str = Field(
120
+ description="Choose your class",
121
+ json_schema_extra={
122
+ "enum": ["warrior", "mage", "rogue", "ranger", "paladin", "bard"],
123
+ "enumNames": [
124
+ "⚔️ Warrior",
125
+ "🔮 Mage",
126
+ "🗡️ Rogue",
127
+ "🏹 Ranger",
128
+ "🛡️ Paladin",
129
+ "🎵 Bard",
130
+ ],
131
+ },
132
+ )
133
+ strength: int = Field(description="Strength (3-18)", ge=3, le=18, default=10)
134
+ intelligence: int = Field(description="Intelligence (3-18)", ge=3, le=18, default=10)
135
+ dexterity: int = Field(description="Dexterity (3-18)", ge=3, le=18, default=10)
136
+ charisma: int = Field(description="Charisma (3-18)", ge=3, le=18, default=10)
137
+ lucky_dice: bool = Field(False, description="Roll for a lucky bonus?")
138
+
139
+ result = await mcp.get_context().elicit(
140
+ f"🎮 Create Character for {campaign_name}!", schema=GameCharacter
141
+ )
142
+
143
+ match result:
144
+ case AcceptedElicitation(data=data):
145
+ response = f"🎭 {data.character_name} the {data.character_class.title()} joins {campaign_name}!\n"
146
+ response += f"Stats: STR:{data.strength} INT:{data.intelligence} DEX:{data.dexterity} CHA:{data.charisma}"
147
+
148
+ if data.lucky_dice:
149
+ dice_roll = random.randint(1, 20)
150
+ if dice_roll >= 15:
151
+ response += f"\n🎲 Lucky roll ({dice_roll})! Starting with bonus equipment!"
152
+ else:
153
+ response += f"\n🎲 Rolled {dice_roll} - Standard starting gear."
154
+
155
+ return response
156
+ case DeclinedElicitation():
157
+ return f"Character creation for {campaign_name} was declined"
158
+ case CancelledElicitation():
159
+ return f"Character creation for {campaign_name} was cancelled"
160
+
161
+
162
+ if __name__ == "__main__":
163
+ logger.info("Starting game character creation server...")
164
+ mcp.run()
@@ -0,0 +1,35 @@
1
+ # Model string takes format:
2
+ # <provider>.<model_string>.<reasoning_effort?> (e.g. anthropic.claude-3-5-sonnet-20241022 or openai.o3-mini.low)
3
+ #
4
+ # Can be overriden with a command line switch --model=<model>, or within the Agent decorator.
5
+ # Check here for current details: https://fast-agent.ai/models/
6
+ default_model: "passthrough"
7
+
8
+ # Logging and Console Configuration
9
+ logger:
10
+ level: "error"
11
+ type: "console"
12
+
13
+ # MCP Server Configuration
14
+ mcp:
15
+ servers:
16
+ # Forms demo server - interactive form examples
17
+ elicitation_forms_server:
18
+ command: "uv"
19
+ args: ["run", "elicitation_forms_server.py"]
20
+ elicitation:
21
+ mode: "forms" # Shows forms to users (default)
22
+
23
+ # Account creation server - for CALL_TOOL demos
24
+ elicitation_account_server:
25
+ command: "uv"
26
+ args: ["run", "elicitation_account_server.py"]
27
+ elicitation:
28
+ mode: "forms"
29
+
30
+ # Game character server - for custom handler demos
31
+ elicitation_game_server:
32
+ command: "uv"
33
+ args: ["run", "elicitation_game_server.py"]
34
+ elicitation:
35
+ mode: "forms"
@@ -0,0 +1,17 @@
1
+ # Secrets configuration for elicitation examples
2
+ #
3
+ # Rename this file to fastagent.secrets.yaml and add your API keys
4
+ # to use the account_creation.py example with real LLMs
5
+
6
+ # OpenAI
7
+ openai_api_key: "sk-..."
8
+
9
+ # Anthropic
10
+ anthropic_api_key: "sk-ant-..."
11
+
12
+ # Google (Gemini)
13
+ google_api_key: "..."
14
+
15
+ # Other providers - see documentation for full list
16
+ # groq_api_key: "..."
17
+ # mistral_api_key: "..."
@@ -0,0 +1,111 @@
1
+ """
2
+ Quick Start: Elicitation Forms Demo
3
+
4
+ This example demonstrates the elicitation forms feature of fast-agent.
5
+
6
+ When Read Resource requests are sent to the MCP Server, it generates an Elicitation
7
+ which creates a form for the user to fill out.
8
+ The results are returned to the demo program which prints out the results in a rich format.
9
+ """
10
+
11
+ import asyncio
12
+
13
+ from rich.console import Console
14
+ from rich.panel import Panel
15
+
16
+ from mcp_agent.core.fastagent import FastAgent
17
+ from mcp_agent.mcp.helpers.content_helpers import get_resource_text
18
+
19
+ fast = FastAgent("Elicitation Forms Demo", quiet=True)
20
+ console = Console()
21
+
22
+
23
+ @fast.agent(
24
+ "forms-demo",
25
+ servers=[
26
+ "elicitation_forms_server",
27
+ ],
28
+ )
29
+ async def main():
30
+ """Run the improved forms demo showcasing all elicitation features."""
31
+ async with fast.run() as agent:
32
+ console.print("\n[bold cyan]Welcome to the Elicitation Forms Demo![/bold cyan]\n")
33
+ console.print("This demo shows how to collect structured data using MCP Elicitations.")
34
+ console.print("We'll present several forms and display the results collected for each.\n")
35
+
36
+ # Example 1: Event Registration
37
+ console.print("[bold yellow]Example 1: Event Registration Form[/bold yellow]")
38
+ console.print(
39
+ "[dim]Demonstrates: string validation, email format, URL format, date format[/dim]"
40
+ )
41
+ result = await agent.get_resource("elicitation://event-registration")
42
+
43
+ if result_text := get_resource_text(result):
44
+ panel = Panel(
45
+ result_text,
46
+ title="🎫 Registration Confirmation",
47
+ border_style="green",
48
+ expand=False,
49
+ )
50
+ console.print(panel)
51
+ else:
52
+ console.print("[red]No registration data received[/red]")
53
+
54
+ console.print("\n" + "─" * 50 + "\n")
55
+
56
+ # Example 2: Product Review
57
+ console.print("[bold yellow]Example 2: Product Review Form[/bold yellow]")
58
+ console.print(
59
+ "[dim]Demonstrates: number validation (range), radio selection, multiline text[/dim]"
60
+ )
61
+ result = await agent.get_resource("elicitation://product-review")
62
+
63
+ if result_text := get_resource_text(result):
64
+ review_panel = Panel(
65
+ result_text, title="🛍️ Product Review", border_style="cyan", expand=False
66
+ )
67
+ console.print(review_panel)
68
+
69
+ console.print("\n" + "─" * 50 + "\n")
70
+
71
+ # Example 3: Account Settings
72
+ console.print("[bold yellow]Example 3: Account Settings Form[/bold yellow]")
73
+ console.print(
74
+ "[dim]Demonstrates: boolean selections, radio selection, number validation[/dim]"
75
+ )
76
+ result = await agent.get_resource("elicitation://account-settings")
77
+
78
+ if result_text := get_resource_text(result):
79
+ settings_panel = Panel(
80
+ result_text, title="⚙️ Account Settings", border_style="blue", expand=False
81
+ )
82
+ console.print(settings_panel)
83
+
84
+ console.print("\n" + "─" * 50 + "\n")
85
+
86
+ # Example 4: Service Appointment
87
+ console.print("[bold yellow]Example 4: Service Appointment Booking[/bold yellow]")
88
+ console.print(
89
+ "[dim]Demonstrates: string validation, radio selection, boolean, datetime format[/dim]"
90
+ )
91
+ result = await agent.get_resource("elicitation://service-appointment")
92
+
93
+ if result_text := get_resource_text(result):
94
+ appointment_panel = Panel(
95
+ result_text, title="🔧 Appointment Confirmed", border_style="magenta", expand=False
96
+ )
97
+ console.print(appointment_panel)
98
+
99
+ console.print("\n[bold green]✅ Demo Complete![/bold green]")
100
+ console.print("\n[bold cyan]Features Demonstrated:[/bold cyan]")
101
+ console.print("• [green]String validation[/green] (min/max length)")
102
+ console.print("• [green]Number validation[/green] (range constraints)")
103
+ console.print("• [green]Radio selections[/green] (enum dropdowns)")
104
+ console.print("• [green]Boolean selections[/green] (checkboxes)")
105
+ console.print("• [green]Format validation[/green] (email, URL, date, datetime)")
106
+ console.print("• [green]Multiline text[/green] (expandable text areas)")
107
+ console.print("\nThese forms demonstrate natural, user-friendly data collection patterns!")
108
+
109
+
110
+ if __name__ == "__main__":
111
+ asyncio.run(main())
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Demonstration of Custom Elicitation Handler
4
+
5
+ This example demonstrates a custom elicitation handler that creates
6
+ an interactive game character creation experience with dice rolls,
7
+ visual gauges, and fun interactions.
8
+ """
9
+
10
+ import asyncio
11
+
12
+ # Import our custom handler from the separate module
13
+ from game_character_handler import game_character_elicitation_handler
14
+ from rich.console import Console
15
+ from rich.panel import Panel
16
+
17
+ from mcp_agent.core.fastagent import FastAgent
18
+ from mcp_agent.mcp.helpers.content_helpers import get_resource_text
19
+
20
+ fast = FastAgent("Game Character Creator", quiet=True)
21
+ console = Console()
22
+
23
+
24
+ @fast.agent(
25
+ "character-creator",
26
+ servers=["elicitation_game_server"],
27
+ # Register our handler from game_character_handler.py
28
+ elicitation_handler=game_character_elicitation_handler,
29
+ )
30
+ async def main():
31
+ """Run the game character creator with custom elicitation handler."""
32
+ async with fast.run() as agent:
33
+ console.print(
34
+ Panel(
35
+ "[bold cyan]Welcome to the Character Creation Studio![/bold cyan]\n\n"
36
+ "Create your hero with our magical character generator.\n"
37
+ "Watch as the cosmic dice determine your fate!",
38
+ title="🎮 Game Time 🎮",
39
+ border_style="magenta",
40
+ )
41
+ )
42
+
43
+ # Trigger the character creation
44
+ result = await agent.get_resource("elicitation://game-character")
45
+
46
+ if result_text := get_resource_text(result):
47
+ character_panel = Panel(
48
+ result_text, title="📜 Your Character 📜", border_style="green", expand=False
49
+ )
50
+ console.print(character_panel)
51
+
52
+ console.print("\n[italic]Your character is ready for adventure![/italic]")
53
+ console.print("[dim]The tavern door opens, and your journey begins...[/dim]\n")
54
+
55
+ # Fun ending based on character
56
+ if "Powerful character" in result_text:
57
+ console.print("⚔️ [bold]The realm trembles at your might![/bold]")
58
+ elif "Challenging build" in result_text:
59
+ console.print("🎯 [bold]True heroes are forged through adversity![/bold]")
60
+ else:
61
+ console.print("🗡️ [bold]Your legend begins now![/bold]")
62
+
63
+
64
+ if __name__ == "__main__":
65
+ asyncio.run(main())
@@ -0,0 +1,256 @@
1
+ """
2
+ Custom Elicitation Handler for Game Character Creation
3
+
4
+ This module provides a whimsical custom elicitation handler that creates
5
+ an interactive game character creation experience with dice rolls,
6
+ visual gauges, and animated effects.
7
+ """
8
+
9
+ import asyncio
10
+ import random
11
+ from typing import TYPE_CHECKING, Any, Dict
12
+
13
+ from mcp.shared.context import RequestContext
14
+ from mcp.types import ElicitRequestParams, ElicitResult
15
+ from rich.console import Console
16
+ from rich.progress import BarColumn, Progress, TextColumn
17
+ from rich.prompt import Confirm
18
+ from rich.table import Table
19
+
20
+ from mcp_agent.logging.logger import get_logger
21
+
22
+ if TYPE_CHECKING:
23
+ from mcp import ClientSession
24
+
25
+ logger = get_logger(__name__)
26
+ console = Console()
27
+
28
+
29
+ async def game_character_elicitation_handler(
30
+ context: RequestContext["ClientSession", Any],
31
+ params: ElicitRequestParams,
32
+ ) -> ElicitResult:
33
+ """Custom handler that creates an interactive character creation experience."""
34
+ logger.info(f"Game character elicitation handler called: {params.message}")
35
+
36
+ if params.requestedSchema:
37
+ properties = params.requestedSchema.get("properties", {})
38
+ content: Dict[str, Any] = {}
39
+
40
+ console.print("\n[bold magenta]🎮 Character Creation Studio 🎮[/bold magenta]\n")
41
+
42
+ # Character name with typewriter effect
43
+ if "character_name" in properties:
44
+ console.print("[cyan]✨ Generating your character's name...[/cyan] ", end="")
45
+ name_prefixes = ["Hero", "Legend", "Epic", "Mighty", "Brave", "Noble"]
46
+ name_suffixes = ["blade", "heart", "storm", "fire", "shadow", "star"]
47
+
48
+ name = f"{random.choice(name_prefixes)}{random.choice(name_suffixes)}{random.randint(1, 999)}"
49
+
50
+ for char in name:
51
+ console.print(char, end="", style="bold green")
52
+ await asyncio.sleep(0.03)
53
+ console.print("\n")
54
+ content["character_name"] = name
55
+
56
+ # Class selection with visual menu and fate dice
57
+ if "character_class" in properties:
58
+ class_enum = properties["character_class"].get("enum", [])
59
+ class_names = properties["character_class"].get("enumNames", class_enum)
60
+
61
+ table = Table(title="🎯 Choose Your Destiny", show_header=False, box=None)
62
+ table.add_column("Option", style="cyan", width=8)
63
+ table.add_column("Class", style="yellow", width=20)
64
+ table.add_column("Description", style="dim", width=30)
65
+
66
+ descriptions = [
67
+ "Master of sword and shield",
68
+ "Wielder of arcane mysteries",
69
+ "Silent shadow striker",
70
+ "Nature's deadly archer",
71
+ "Holy warrior of light",
72
+ "Inspiring magical performer",
73
+ ]
74
+
75
+ for i, (cls, name, desc) in enumerate(zip(class_enum, class_names, descriptions)):
76
+ table.add_row(f"[{i + 1}]", name, desc)
77
+
78
+ console.print(table)
79
+
80
+ # Dramatic fate dice roll
81
+ console.print("\n[bold yellow]🎲 The Fates decide your path...[/bold yellow]")
82
+ for _ in range(8):
83
+ dice_face = random.choice(["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"])
84
+ console.print(f"\r Rolling... {dice_face}", end="")
85
+ await asyncio.sleep(0.2)
86
+
87
+ fate_roll = random.randint(1, 6)
88
+ selected_idx = (fate_roll - 1) % len(class_enum)
89
+ console.print(f"\n 🎲 Fate dice: [bold red]{fate_roll}[/bold red]!")
90
+ console.print(
91
+ f"✨ Destiny has chosen: [bold yellow]{class_names[selected_idx]}[/bold yellow]!\n"
92
+ )
93
+ content["character_class"] = class_enum[selected_idx]
94
+
95
+ # Stats rolling with animated progress bars and cosmic effects
96
+ stat_names = ["strength", "intelligence", "dexterity", "charisma"]
97
+ stats_info = {
98
+ "strength": {"emoji": "💪", "desc": "Physical power"},
99
+ "intelligence": {"emoji": "🧠", "desc": "Mental acuity"},
100
+ "dexterity": {"emoji": "🏃", "desc": "Agility & speed"},
101
+ "charisma": {"emoji": "✨", "desc": "Personal magnetism"},
102
+ }
103
+
104
+ console.print("[bold]🌟 Rolling cosmic dice for your abilities...[/bold]\n")
105
+
106
+ with Progress(
107
+ TextColumn("[progress.description]{task.description}"),
108
+ BarColumn(bar_width=25, style="cyan", complete_style="green"),
109
+ TextColumn("[progress.percentage]{task.percentage:>3.0f}%"),
110
+ console=console,
111
+ ) as progress:
112
+ for stat in stat_names:
113
+ if stat in properties:
114
+ # Roll 3d6 for classic D&D feel with bonus potential
115
+ rolls = [random.randint(1, 6) for _ in range(3)]
116
+ total = sum(rolls)
117
+
118
+ # Add cosmic bonus chance
119
+ if random.random() < 0.15: # 15% chance for cosmic boost
120
+ cosmic_bonus = random.randint(1, 3)
121
+ total = min(18, total + cosmic_bonus)
122
+ cosmic_text = f" ✨+{cosmic_bonus} COSMIC✨"
123
+ else:
124
+ cosmic_text = ""
125
+
126
+ stat_info = stats_info.get(stat, {"emoji": "📊", "desc": stat.title()})
127
+ task = progress.add_task(
128
+ f"{stat_info['emoji']} {stat.capitalize()}: {stat_info['desc']}", total=18
129
+ )
130
+
131
+ # Animate the progress bar with suspense
132
+ for i in range(total + 1):
133
+ progress.update(task, completed=i)
134
+ await asyncio.sleep(0.04)
135
+
136
+ content[stat] = total
137
+ console.print(
138
+ f" 🎲 Rolled: {rolls} = [bold green]{total}[/bold green]{cosmic_text}"
139
+ )
140
+
141
+ # Lucky dice legendary challenge
142
+ if "lucky_dice" in properties:
143
+ console.print("\n" + "=" * 60)
144
+ console.print("[bold yellow]🎰 LEGENDARY CHALLENGE: Lucky Dice! 🎰[/bold yellow]")
145
+ console.print("The ancient dice of fortune whisper your name...")
146
+ console.print("Do you dare tempt fate for legendary power?")
147
+ console.print("=" * 60)
148
+
149
+ # Epic dice rolling sequence
150
+ console.print("\n[cyan]🌟 Rolling the Dice of Destiny...[/cyan]")
151
+
152
+ for i in range(15):
153
+ dice_faces = ["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"]
154
+ d20_faces = ["🎲"] * 19 + ["💎"] # Special diamond for 20
155
+
156
+ if i < 10:
157
+ face = random.choice(dice_faces)
158
+ else:
159
+ face = random.choice(d20_faces)
160
+
161
+ console.print(f"\r [bold]{face}[/bold] Rolling...", end="")
162
+ await asyncio.sleep(0.15)
163
+
164
+ final_roll = random.randint(1, 20)
165
+
166
+ if final_roll == 20:
167
+ console.print("\r [bold red]💎 NATURAL 20! 💎[/bold red]")
168
+ console.print(" [bold green]🌟 LEGENDARY SUCCESS! 🌟[/bold green]")
169
+ console.print(" [gold1]You have been blessed by the gods themselves![/gold1]")
170
+ bonus_text = "🏆 Divine Champion status unlocked!"
171
+ elif final_roll >= 18:
172
+ console.print(f"\r [bold yellow]⭐ {final_roll} - EPIC ROLL! ⭐[/bold yellow]")
173
+ bonus_text = "🎁 Epic treasure discovered!"
174
+ elif final_roll >= 15:
175
+ console.print(f"\r [green]🎲 {final_roll} - Great success![/green]")
176
+ bonus_text = "🌟 Rare magical item found!"
177
+ elif final_roll >= 10:
178
+ console.print(f"\r [yellow]🎲 {final_roll} - Good fortune.[/yellow]")
179
+ bonus_text = "🗡️ Modest blessing received."
180
+ elif final_roll == 1:
181
+ console.print("\r [bold red]💀 CRITICAL FUMBLE! 💀[/bold red]")
182
+ bonus_text = "😅 Learning experience gained... try again!"
183
+ else:
184
+ console.print(f"\r [dim]🎲 {final_roll} - The dice are silent.[/dim]")
185
+ bonus_text = "🎯 Your destiny remains unwritten."
186
+
187
+ console.print(f" [italic]{bonus_text}[/italic]")
188
+ content["lucky_dice"] = final_roll >= 10
189
+
190
+ # Epic character summary with theatrical flair
191
+ console.print("\n" + "=" * 70)
192
+ console.print("[bold cyan]📜 Your Character Has Been Rolled! 📜[/bold cyan]")
193
+ console.print("=" * 70)
194
+
195
+ # Show character summary
196
+ total_stats = sum(content.get(stat, 10) for stat in stat_names if stat in content)
197
+
198
+ # Create a simple table
199
+ stats_table = Table(show_header=False, box=None)
200
+ stats_table.add_column("Label", style="cyan", width=15)
201
+ stats_table.add_column("Value", style="bold white")
202
+
203
+ if "character_name" in content:
204
+ stats_table.add_row("Name:", content["character_name"])
205
+ if "character_class" in content:
206
+ class_idx = class_enum.index(content["character_class"])
207
+ stats_table.add_row("Class:", class_names[class_idx])
208
+
209
+ stats_table.add_row("", "") # Empty row for spacing
210
+
211
+ # Add stats
212
+ for stat in stat_names:
213
+ if stat in content:
214
+ stat_label = f"{stat.capitalize()}:"
215
+ stats_table.add_row(stat_label, str(content[stat]))
216
+
217
+ stats_table.add_row("", "")
218
+ stats_table.add_row("Total Power:", str(total_stats))
219
+
220
+ console.print(stats_table)
221
+
222
+ # Power message
223
+ if total_stats > 60:
224
+ console.print("✨ [bold gold1]The realm trembles before your might![/bold gold1] ✨")
225
+ elif total_stats > 50:
226
+ console.print("⚔️ [bold green]A formidable hero rises![/bold green] ⚔️")
227
+ elif total_stats < 35:
228
+ console.print("🎯 [bold blue]The underdog's tale begins![/bold blue] 🎯")
229
+ else:
230
+ console.print("🗡️ [bold white]Adventure awaits the worthy![/bold white] 🗡️")
231
+
232
+ # Ask for confirmation
233
+ console.print("\n[bold yellow]Do you accept this character?[/bold yellow]")
234
+ console.print("[dim]Press Enter to accept, 'n' to decline, or Ctrl+C to cancel[/dim]\n")
235
+
236
+ try:
237
+ accepted = Confirm.ask("Accept character?", default=True)
238
+
239
+ if accepted:
240
+ console.print(
241
+ "\n[bold green]✅ Character accepted! Your adventure begins![/bold green]"
242
+ )
243
+ return ElicitResult(action="accept", content=content)
244
+ else:
245
+ console.print(
246
+ "\n[yellow]❌ Character declined. The fates will roll again...[/yellow]"
247
+ )
248
+ return ElicitResult(action="decline")
249
+ except KeyboardInterrupt:
250
+ console.print("\n[red]❌ Character creation cancelled![/red]")
251
+ return ElicitResult(action="cancel")
252
+
253
+ else:
254
+ # No schema, return a fun message
255
+ content = {"response": "⚔️ Ready for adventure! ⚔️"}
256
+ return ElicitResult(action="accept", content=content)
@@ -3,19 +3,18 @@ import asyncio
3
3
  from mcp_agent.core.fastagent import FastAgent
4
4
 
5
5
  # Create the application
6
- fast = FastAgent("FastAgent Example")
6
+ fast = FastAgent("fast-agent example")
7
7
 
8
8
 
9
9
  # Define the agent
10
10
  @fast.agent(
11
- "agent",
12
11
  instruction="You are a helpful AI Agent",
13
- servers=["prompts"], # , "imgetage", "hfspace"],
12
+ servers=["elicitation_account_server"],
14
13
  )
15
- async def main() -> None:
14
+ async def main():
16
15
  # use the --model command line switch or agent arguments to change model
17
16
  async with fast.run() as agent:
18
- await agent()
17
+ await agent.send('***CALL_TOOL create_user_account {"service_name": "fast-agent"}')
19
18
 
20
19
 
21
20
  if __name__ == "__main__":