Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ import re
|
|
| 10 |
import json
|
| 11 |
import sys
|
| 12 |
from io import StringIO
|
| 13 |
-
from typing import List, Dict, Tuple
|
| 14 |
|
| 15 |
import gradio as gr
|
| 16 |
import requests
|
|
@@ -251,13 +251,13 @@ def _format_markdown(
|
|
| 251 |
|
| 252 |
|
| 253 |
def Fetch_Webpage( # <-- MCP tool #1 (Fetch)
|
| 254 |
-
url: str,
|
| 255 |
-
verbosity: str = "Standard",
|
| 256 |
-
include_metadata: bool = True,
|
| 257 |
-
include_text: bool = True,
|
| 258 |
-
include_links: bool = True,
|
| 259 |
-
max_chars: int = 3000,
|
| 260 |
-
max_links: int = 20,
|
| 261 |
) -> str:
|
| 262 |
"""
|
| 263 |
Fetch a web page and return a compact Markdown summary containing title, key
|
|
@@ -368,12 +368,12 @@ def Fetch_Webpage( # <-- MCP tool #1 (Fetch)
|
|
| 368 |
# ============================================
|
| 369 |
|
| 370 |
def Search_DuckDuckGo( # <-- MCP tool #2 (DDG Search)
|
| 371 |
-
query: str,
|
| 372 |
-
max_results: int = 5,
|
| 373 |
-
include_snippets: bool = False,
|
| 374 |
-
max_snippet_chars: int = 80,
|
| 375 |
-
dedupe_domains: bool = True,
|
| 376 |
-
title_chars: int = 80,
|
| 377 |
) -> str:
|
| 378 |
"""
|
| 379 |
Run a DuckDuckGo search and return ultra-compact JSONL with short keys to
|
|
@@ -448,7 +448,7 @@ def Search_DuckDuckGo( # <-- MCP tool #2 (DDG Search)
|
|
| 448 |
# Code Execution: Python (MCP tool #6)
|
| 449 |
# ======================================
|
| 450 |
|
| 451 |
-
def Execute_Python(code: str) -> str:
|
| 452 |
"""
|
| 453 |
Execute arbitrary Python code and return captured stdout or an error message.
|
| 454 |
|
|
|
|
| 10 |
import json
|
| 11 |
import sys
|
| 12 |
from io import StringIO
|
| 13 |
+
from typing import List, Dict, Tuple, Annotated
|
| 14 |
|
| 15 |
import gradio as gr
|
| 16 |
import requests
|
|
|
|
| 251 |
|
| 252 |
|
| 253 |
def Fetch_Webpage( # <-- MCP tool #1 (Fetch)
|
| 254 |
+
url: Annotated[str, "The absolute URL to fetch (must return HTML)."] ,
|
| 255 |
+
verbosity: Annotated[str, "Controls body length: one of 'Brief', 'Standard', or 'Full'."] = "Standard",
|
| 256 |
+
include_metadata: Annotated[bool, "Include a Metadata section (description, site name, canonical, lang, fetched URL)."] = True,
|
| 257 |
+
include_text: Annotated[bool, "Include the readable main text extracted with Readability."] = True,
|
| 258 |
+
include_links: Annotated[bool, "Include outbound links discovered in the readable section."] = True,
|
| 259 |
+
max_chars: Annotated[int, "Hard cap for body characters after the verbosity preset. Use 0 to disable the cap."] = 3000,
|
| 260 |
+
max_links: Annotated[int, "Maximum number of links to include from the readable content. Set 0 to omit links."] = 20,
|
| 261 |
) -> str:
|
| 262 |
"""
|
| 263 |
Fetch a web page and return a compact Markdown summary containing title, key
|
|
|
|
| 368 |
# ============================================
|
| 369 |
|
| 370 |
def Search_DuckDuckGo( # <-- MCP tool #2 (DDG Search)
|
| 371 |
+
query: Annotated[str, "The search query (supports operators like site:, quotes, OR)."] ,
|
| 372 |
+
max_results: Annotated[int, "Number of results to return (1–20)."] = 5,
|
| 373 |
+
include_snippets: Annotated[bool, "Include a short snippet for each result (adds tokens)."] = False,
|
| 374 |
+
max_snippet_chars: Annotated[int, "Character cap applied to each snippet when included."] = 80,
|
| 375 |
+
dedupe_domains: Annotated[bool, "If true, only the first result from each domain is kept."] = True,
|
| 376 |
+
title_chars: Annotated[int, "Character cap applied to titles."] = 80,
|
| 377 |
) -> str:
|
| 378 |
"""
|
| 379 |
Run a DuckDuckGo search and return ultra-compact JSONL with short keys to
|
|
|
|
| 448 |
# Code Execution: Python (MCP tool #6)
|
| 449 |
# ======================================
|
| 450 |
|
| 451 |
+
def Execute_Python(code: Annotated[str, "Python source code to run; stdout is captured and returned."]) -> str:
|
| 452 |
"""
|
| 453 |
Execute arbitrary Python code and return captured stdout or an error message.
|
| 454 |
|