
     h0                    D   d dl mZ d dlZd dlZd dlmZ d dlmZm	Z	m
Z
 d dlmZmZmZ d dlmZ d dlmZmZmZmZ d dlmZ d d	lmZ  ee          Ze
d
         Ze
d         Z G d de          Z G d ded          Z G d de          Z  G d de          Z!ddZ"dS )    )annotationsN)Path)	AnnotatedAnyLiteral)FieldImportStringfield_validator)	FieldInfo)BaseSettingsEnvSettingsSourcePydanticBaseSettingsSourceSettingsConfigDict)Self)
get_logger)DEBUGINFOWARNINGERRORCRITICAL)warnerrorreplaceignorec                  $     e Zd ZdZd	 fdZ xZS )
ExtendedEnvSettingsSourcez
    A special EnvSettingsSource that allows for multiple env var prefixes to be used.

    Raises a deprecation warning if the old `FASTMCP_SERVER_` prefix is used.
    fieldr   
field_namestrreturntuple[Any, str, bool]c                6   | j                             d          x}r[|D ]X}|| _        t                                          ||          \  }}}|'|dk    rt
                              d           |||fc S Yt                                          ||          S )Nenv_prefixesFASTMCP_SERVER_zTUsing `FASTMCP_SERVER_` environment variables is deprecated. Use `FASTMCP_` instead.)configget
env_prefixsuperget_field_valueloggerwarning)	selfr   r   prefixesprefixenv_val	field_keyvalue_is_complex	__class__s	           b/Users/user/workspace/sujinbaek/cqa-test-app/venv/lib/python3.11/site-packages/fastmcp/settings.pyr)   z)ExtendedEnvSettingsSource.get_field_value"   s     {~6668 	@" @ @"(7<ww7N7N:8 84$4 &!222r   #I/????? ' ww&&uj999    )r   r   r   r   r    r!   )__name__
__module____qualname____doc__r)   __classcell__)r2   s   @r3   r   r      sG         : : : : : : : : : :r4   r   c                      e Zd ZU ded<   dS )ExtendedSettingsConfigDictzlist[str] | Noner#   N)r5   r6   r7   __annotations__ r4   r3   r;   r;   6   s         """"""r4   r;   F)totalc                  8    e Zd ZU  edd          ZdZded<   dS )ExperimentalSettingsFASTMCP_EXPERIMENTAL_r   )r'   extraFzAnnotated[bool, Field(description=inspect.cleandoc('\n                Whether to use the new OpenAPI parser. This parser was introduced\n                for testing in 2.11 and will become the default soon.\n                '))]enable_new_openapi_parserN)r5   r6   r7   r   model_configrC   r<   r=   r4   r3   r@   r@   :   sQ         %%*  L 	  
 
 
 
 
 
r4   r@   c                  h   e Zd ZU dZ eddgddddd          ZdWdZdXdZedYd            Z	e
dZd            Z ej                    dz  Zded<   dZd ed!<   dZd ed"<   d#Zd$ed%<    ed%d&'          ed(                         Z e            Zd)ed*<   dZd+ed,<   dZd-ed.<   dZd/ed0<   d1Zd2ed3<   d4Zd5ed6<   d7Zd
ed8<   d9Zd:ed;<   d<Zd
ed=<   d>Zd
ed?<   d@Zd
edA<   dZ d edB<   dZ!dCedD<    e"e#dEF          Z$dGedH<   dZ%d edI<   dZ&d edJ<   d4Z'dKedL<   d4Z(dMedN<   d4Z)dOedP<   dZ*dQedR<   dZ+dSedT<   dZ,dUedV<   d4S )[SettingszFastMCP settings.FASTMCP_r$   z.envr   __T)r#   env_filerB   env_nested_delimiter#nested_model_default_partial_updatevalidate_assignmentattrr   r    r   c                    | }d|v rP|                     dd          \  }}t          ||          st          d| d          t          ||          }d|v Pt          ||          S )zz
        Get a setting. If the setting contains one or more `__`, it will be
        treated as a nested setting.
        rH      Setting  does not exist.)splithasattrAttributeErrorgetattr)r,   rM   settingsparent_attrs       r3   get_settingzSettings.get_settingY   s    
 dll $

4 3 3K8[11 O$%M%M%M%MNNNx55H	 dll
 x&&&r4   valueNonec                    | }d|v rP|                     dd          \  }}t          ||          st          d| d          t          ||          }d|v Pt	          |||           dS )zz
        Set a setting. If the setting contains one or more `__`, it will be
        treated as a nested setting.
        rH   rO   rP   rQ   N)rR   rS   rT   rU   setattr)r,   rM   rY   rV   rW   s        r3   set_settingzSettings.set_settingf   s    
 dll $

4 3 3K8[11 O$%M%M%M%MNNNx55H	 dll
 	$&&&&&r4   settings_clstype[BaseSettings]init_settingsr   env_settingsdotenv_settingsfile_secret_settings&tuple[PydanticBaseSettingsSource, ...]c                (    |t          |          ||fS N)r   )clsr^   r`   ra   rb   rc   s         r3   settings_customise_sourcesz#Settings.settings_customise_sourcess   s"     %l33 	
 	
r4   r   c                :    t                               d           | S )z
        This property is for backwards compatibility with FastMCP < 2.8.0,
        which accessed fastmcp.settings.settings
        zLUsing fastmcp.settings.settings is deprecated. Use fastmcp.settings instead.)r*   r+   )r,   s    r3   rV   zSettings.settings   s$     	Z	
 	
 	
 r4   z.fastmcpr   homeFbool	test_modelog_enabledr   	LOG_LEVEL	log_levelbefore)modec                X    t          |t                    r|                                S |S rf   )
isinstancer   upper)rg   vs     r3   normalize_log_levelzSettings.normalize_log_level   s)     a 	7799r4   r@   experimentalzAnnotated[bool, Field(description=inspect.cleandoc('\n                If True, will use rich tracebacks for logging.\n                '))]enable_rich_tracebacksa_  Annotated[bool, Field(description=inspect.cleandoc("\n                Whether to show deprecation warnings. You can completely reset\n                Python's warning behavior by running `warnings.resetwarnings()`.\n                Note this will NOT apply to deprecation warnings from the\n                settings class itself.\n                "))]deprecation_warningsa  Annotated[bool, Field(default=True, description=inspect.cleandoc('\n                Many MCP components operate in anyio taskgroups, and raise\n                ExceptionGroups instead of exceptions. If this setting is True, FastMCP Clients\n                will `raise` the first error in any ExceptionGroup instead of raising\n                the ExceptionGroup as a whole. This is useful for debugging, but may\n                mask other errors.\n                '))]'client_raise_first_exceptiongroup_errorpatha  Annotated[Literal['protocol', 'path'], Field(default='path', description=inspect.cleandoc('\n                When perfixing a resource URI, either use path formatting (resource://prefix/path)\n                or protocol formatting (prefix+resource://path). Protocol formatting was the default in FastMCP < 2.4;\n                path formatting is current default.\n                '))]resource_prefix_formatNzAnnotated[float | None, Field(description="The timeout for the client's initialization handshake, in seconds. Set to None or 0 to disable.")]client_init_timeoutz	127.0.0.1hosti@  intportz/ssesse_pathz
/messages/message_pathz/mcpstreamable_http_pathdebuga  Annotated[bool, Field(default=False, description=inspect.cleandoc('\n                If True, error details from user-supplied functions (tool, resource, prompt)\n                will be masked before being sent to clients. Only error messages from explicitly\n                raised ToolError, ResourceError, or PromptError will be included in responses.\n                If False (default), all error details will be included in responses, but prefixed\n                with appropriate context.\n                '))]mask_error_detailsz9List of dependencies to install in the server environment)default_factorydescriptionz	list[str]server_dependenciesjson_responsestateless_httpa?  Annotated[ImportString | None, Field(description=inspect.cleandoc("\n                Configure the authentication provider for the server by specifying\n                the full module path to an AuthProvider class (e.g., \n                'fastmcp.server.auth.providers.google.GoogleProvider').\n\n                The specified class will be imported and instantiated automatically.\n                Any class that inherits from AuthProvider can be used, including\n                custom implementations.\n\n                If None, no automatic configuration will take place.\n\n                This setting is *always* overridden by any auth provider passed to the\n                FastMCP constructor.\n\n                Note that most auth providers require additional configuration\n                that must be provided via env vars.\n\n                Examples:\n                  - fastmcp.server.auth.providers.google.GoogleProvider\n                  - fastmcp.server.auth.providers.jwt.JWTVerifier\n                  - mycompany.auth.CustomAuthProvider\n                "))]server_autha=  Annotated[set[str] | None, Field(default=None, description=inspect.cleandoc('\n                If provided, only components that match these tags will be\n                exposed to clients. A component is considered to match if ANY of\n                its tags match ANY of the tags in the set.\n                '))]include_tagsa>  Annotated[set[str] | None, Field(default=None, description=inspect.cleandoc('\n                If provided, components that match these tags will be excluded\n                from the server. A component is considered to match if ANY of\n                its tags match ANY of the tags in the set.\n                '))]exclude_tagsa  Annotated[bool, Field(default=True, description=inspect.cleandoc("\n                Whether to include FastMCP meta in the server's MCP responses.\n                If True, a `_fastmcp` key will be added to the `meta` field of\n                all MCP component responses. This key will contain a dict of\n                various FastMCP-specific metadata, such as tags.\n                "))]include_fastmcp_metaaT  Annotated[bool, Field(default=False, description=inspect.cleandoc('\n                If True, errors encountered when loading mounted components (tools, resources, prompts)\n                will be raised instead of logged as warnings. This is useful for debugging\n                but will interrupt normal operation.\n                '))]&mounted_components_raise_on_load_errora\  Annotated[bool, Field(default=True, description=inspect.cleandoc('\n                If True, the server banner will be displayed when running the server via CLI.\n                This setting can be overridden by the --no-banner CLI flag.\n                Set to False via FASTMCP_SHOW_CLI_BANNER=false to suppress the banner.\n                '))]show_cli_banner)rM   r   r    r   )rM   r   rY   r   r    rZ   )r^   r_   r`   r   ra   r   rb   r   rc   r   r    rd   )r    r   )-r5   r6   r7   r8   r;   rD   rX   r]   classmethodrh   propertyrV   r   rj   r<   rl   rm   ro   r
   rv   r@   rw   rx   ry   rz   r|   r}   r~   r   r   r   r   r   r   r   listr   r   r   r   r   r   r   r   r   r=   r4   r3   rF   rF   M   s        -- "34!,0   L' ' ' '' ' ' ' 
 
 
 [
" 	 	 	 X	 z)D))))IK!I!!!!_[x000  [ 10
 *>)=)?)?L???? 	  	 	 	 	. 	     8 	 ,    8 	     & 	      DDH$L$$$$ &&&&&E" 	       &+UO& & &      M     B 	9     T 	     2 	     6 	     6 	 +    4 	       r4   rF   namer   c                    | dk    r0ddl }|j        }|j        rt          j        dt
          d           |S t          dt           d|  d	          )
zo
    Used to deprecate the module-level Image class; can be removed once it is no longer imported to root.
    rV   r   NzV`from fastmcp.settings import settings` is deprecated. use `fastmcp.settings` instead.   )
stacklevelzmodule 'z' has no attribute '')fastmcprV   ry   warningsr   DeprecationWarningrT   r5   )r   r   rV   s      r3   __getattr__r   i  sv     z#( 	Mh"   
 
IHII$III
J
JJr4   )r   r   )#
__future__r   _annotationsinspectr   pathlibr   typingr   r   r   pydanticr   r	   r
   pydantic.fieldsr   pydantic_settingsr   r   r   r   typing_extensionsr   fastmcp.utilities.loggingr   r5   r*   rn   DuplicateBehaviorr   r;   r@   rF   r   r=   r4   r3   <module>r      s   2 2 2 2 2 2         * * * * * * * * * * 9 9 9 9 9 9 9 9 9 9 % % % % % %            # " " " " " 0 0 0 0 0 0	H		CD	@A : : : : : 1 : : :6# # # # #!35 # # # #    <   &Y Y Y Y Y| Y Y YxK K K K K Kr4   