Spaces:
Running
Running
File size: 844 Bytes
4f368c2 fe17d4c 925a3bd fe17d4c 925a3bd 4f368c2 ff020c1 925a3bd 4f368c2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import gradio as gr
def slice_list(lst: list, start: int, end: int) -> list:
"""
A tool that slices a list given a start and end index.
Args:
lst: The list to slice.
start: The start index.
end: The end index.
Returns:
The sliced list.
"""
return lst[start:end]
def say_hello(name: str) -> str:
"""
A tool that returns message "Hello <name>"
Args:
str: name to say hello to.
Returns:
Hello <name>
"""
return f"Hello, {name}"
with gr.Blocks() as demo:
gr.Markdown(
"""
This is a demo of a MCP-only tool.
This tool slices a list.
This tool is MCP-only, so it does not have a UI.
"""
)
gr.api(
slice_list
)
gr.api(
say_hello
)
_, url, _ = demo.launch(mcp_server=True) |