Overview
Golf utilities provide four core capabilities:- Context Access - Direct access to FastMCP context without manual parameter passing
- Elicitation - Interactive user prompting and input collection
- Sampling - LLM interactions and text generation with multiple modes
- Authentication Integration - Seamless token extraction
contextvars for thread-safe, async-aware access to FastMCP features.
Context access
Get current context
Theget_current_context() function provides direct access to the FastMCP context without requiring explicit context parameter passing.
Context with logging
Error handling
Elicitation utilities
Elicitation utilities enable your tools to interact with users, collect additional information, and create dynamic conversational experiences.Basic elicitation
Type-safe elicitation
Confirmation dialogs
Advanced elicitation with error handling
Sampling utilities
Sampling utilities provide direct access to LLM capabilities within your tools, enabling text generation, analysis, and AI-powered processing with multiple modes.Basic sampling
Structured sampling
Thesample_structured() function uses a lower temperature (0.1) for more consistent, formatted outputs.
Context-enhanced sampling
Thesample_with_context() function automatically appends context data to prompts.