Add get_sampler_scheduler_list MCP Tools.
Browse filesFiles changed (5)
7 unmodified lines89101112131415161718192021221 unmodified line2425262728294 unmodified lines3435363738397 unmodified linesfrom .get_model_list import handle_get_model_listfrom .get_feature_list import handle_get_feature_listfrom .get_model_features import handle_get_model_featuresfrom .run import handle_runfrom .get_task_status import handle_get_task_statusfrom .error_schema import make_error, make_validation_error, make_not_found_errorfrom .mcp_gradio_integration import (register_high_level_mcp_apis,cleanup_dependencies_api_names,patch_gradio_api_suppression,HIGH_LEVEL_MCP_API_NAMES,)MCP_FUNCTIONS = [handle_get_task_list,1 unmodified linehandle_get_model_list,handle_get_feature_list,handle_get_model_features,handle_run,handle_get_task_status,]4 unmodified lines"handle_get_model_list","handle_get_feature_list","handle_get_model_features","handle_run","handle_get_task_status","make_error",7 unmodified lines8910111213141516171819202122232425262728291 unmodified line313233343536374 unmodified lines424344454647487 unmodified linesfrom .get_model_list import handle_get_model_listfrom .get_feature_list import handle_get_feature_listfrom .get_model_features import handle_get_model_featuresfrom .get_sampler_scheduler_list import handle_get_sampler_scheduler_listfrom .run import handle_runfrom .get_task_status import handle_get_task_statusfrom .error_schema import make_error, make_validation_error, make_not_found_errortry:from .mcp_gradio_integration import (register_high_level_mcp_apis,cleanup_dependencies_api_names,patch_gradio_api_suppression,HIGH_LEVEL_MCP_API_NAMES,)except ImportError:register_high_level_mcp_apis = Nonecleanup_dependencies_api_names = Nonepatch_gradio_api_suppression = NoneHIGH_LEVEL_MCP_API_NAMES = set()MCP_FUNCTIONS = [handle_get_task_list,1 unmodified linehandle_get_model_list,handle_get_feature_list,handle_get_model_features,handle_get_sampler_scheduler_list,handle_run,handle_get_task_status,]4 unmodified lines"handle_get_model_list","handle_get_feature_list","handle_get_model_features","handle_get_sampler_scheduler_list","handle_run","handle_get_task_status","make_error",
123456789101112131415161718"""MCP Tool: get_sampler_scheduler_listQuery all supported Sampler algorithms and Noise Schedulers available for image generation tasks."""
try: from comfy_integration.nodes import SAMPLER_CHOICES, SCHEDULER_CHOICESexcept Exception: SAMPLER_CHOICES = ['euler', 'dpmpp_2m_sde_gpu'] SCHEDULER_CHOICES = ['normal', 'karras']
def handle_get_sampler_scheduler_list() -> dict: """Query all supported Sampler algorithms and Noise Schedulers available for image generation tasks.""" return { "samplers": list(SAMPLER_CHOICES), "schedulers": list(SCHEDULER_CHOICES), }14 unmodified lines1516171819203 unmodified lines24252627282918 unmodified lines4849505152535416 unmodified lines7172737475767724 unmodified lines10210310410510610734 unmodified lines1421431441451461475 unmodified lines15315415515614 unmodified linesfrom .get_model_list import handle_get_model_listfrom .get_feature_list import handle_get_feature_listfrom .get_model_features import handle_get_model_featuresfrom .run import handle_runfrom .get_task_status import handle_get_task_status3 unmodified lines"get_model_list","get_feature_list","get_model_features","run","get_task_status",}18 unmodified linesdef cleanup_dependencies_api_names(demo):"""Clean up residual auto-generated API names in demo.fns and demo.dependencies.Force only the 7 high-level abstract MCP APIs to be exposed as public endpoints."""for fn in demo.fns.values():api_name = getattr(fn, "api_name", None)16 unmodified linesdef register_high_level_mcp_apis(demo):"""Explicitly register 7 high-level abstract MCP API endpoints on the Gradio demo using gr.api.Using gr.api() never adds any visual UI components (such as Row, Textbox, Button, etc.), avoiding duplicate interface rendering."""def get_task_list() -> list:24 unmodified linesmodel_str = model.strip() if isinstance(model, str) else ""return sanitize_keys(handle_get_model_features(model_str))def run(json_params: str = "{}") -> dict:"""[Recommended Discovery Flow Step 4] Unified image generation task execution interface. Accepts a JSON string or dict of parameters.34 unmodified linesget_model_list,get_feature_list,get_model_features,run,get_task_status,]5 unmodified linesif getattr(fn, "api_name", None) in HIGH_LEVEL_MCP_API_NAMES:fn.show_api = Trueprint("[MCP Integration] Successfully registered 7 High-Level Abstract MCP APIs via gr.api().")14 unmodified lines151617181920213 unmodified lines2526272829303118 unmodified lines5051525354555616 unmodified lines7374757677787924 unmodified lines10410510610710810911011111211334 unmodified lines1481491501511521531545 unmodified lines16016116216314 unmodified linesfrom .get_model_list import handle_get_model_listfrom .get_feature_list import handle_get_feature_listfrom .get_model_features import handle_get_model_featuresfrom .get_sampler_scheduler_list import handle_get_sampler_scheduler_listfrom .run import handle_runfrom .get_task_status import handle_get_task_status3 unmodified lines"get_model_list","get_feature_list","get_model_features","get_sampler_scheduler_list","run","get_task_status",}18 unmodified linesdef cleanup_dependencies_api_names(demo):"""Clean up residual auto-generated API names in demo.fns and demo.dependencies.Force only high-level abstract MCP APIs to be exposed as public endpoints."""for fn in demo.fns.values():api_name = getattr(fn, "api_name", None)16 unmodified linesdef register_high_level_mcp_apis(demo):"""Explicitly register high-level abstract MCP API endpoints on the Gradio demo using gr.api.Using gr.api() never adds any visual UI components (such as Row, Textbox, Button, etc.), avoiding duplicate interface rendering."""def get_task_list() -> list:24 unmodified linesmodel_str = model.strip() if isinstance(model, str) else ""return sanitize_keys(handle_get_model_features(model_str))def get_sampler_scheduler_list() -> dict:"""Query all supported Sampler algorithms and Noise Schedulers available for image generation tasks."""return sanitize_keys(handle_get_sampler_scheduler_list())def run(json_params: str = "{}") -> dict:"""[Recommended Discovery Flow Step 4] Unified image generation task execution interface. Accepts a JSON string or dict of parameters.34 unmodified linesget_model_list,get_feature_list,get_model_features,get_sampler_scheduler_list,run,get_task_status,]5 unmodified linesif getattr(fn, "api_name", None) in HIGH_LEVEL_MCP_API_NAMES:fn.show_api = Trueprint(f"[MCP Integration] Successfully registered {len(funcs)} High-Level Abstract MCP APIs via gr.api().")
7 unmodified lines89101112139 unmodified lines2324252627287 unmodified linesfrom .get_model_list import handle_get_model_listfrom .get_feature_list import handle_get_feature_listfrom .get_model_features import handle_get_model_featuresfrom .run import handle_runfrom .get_task_status import handle_get_task_statusfrom .common import (9 unmodified lines"handle_get_model_list","handle_get_feature_list","handle_get_model_features","handle_run","handle_get_task_status",]7 unmodified lines8910111213149 unmodified lines242526272829307 unmodified linesfrom .get_model_list import handle_get_model_listfrom .get_feature_list import handle_get_feature_listfrom .get_model_features import handle_get_model_featuresfrom .get_sampler_scheduler_list import handle_get_sampler_scheduler_listfrom .run import handle_runfrom .get_task_status import handle_get_task_statusfrom .common import (9 unmodified lines"handle_get_model_list","handle_get_feature_list","handle_get_model_features","handle_get_sampler_scheduler_list","handle_run","handle_get_task_status",]
12345comfyui-frontend-package==1.48.7comfyui-workflow-templates==0.11.37comfyui-embedded-docs==0.5.9torchtorchsde12345comfyui-frontend-package==1.48.7comfyui-workflow-templates==0.11.39comfyui-embedded-docs==0.5.9torchtorchsde
mcp_tools/__init__.py+15-6
mcp_tools/get_sampler_scheduler_list.pyAdded+18
mcp_tools/mcp_gradio_integration.py+10-3
mcp_tools/tool_handlers.py+2
requirements.txt+1-1