-
Notifications
You must be signed in to change notification settings - Fork 772
update mcp dependency; add ability to add icons #560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7a07857
c577c45
536c453
183e6f5
9a9f968
3057704
3fd7eed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,6 @@ | |
| from mcp import ServerSession | ||
| from mcp.server.fastmcp import FastMCP | ||
| from mcp.types import ToolAnnotations, Icon | ||
|
|
||
| from mcp_agent.core.context import Context, initialize_context, cleanup_context | ||
| from mcp_agent.config import Settings, get_settings | ||
| from mcp_agent.executor.signal_registry import SignalRegistry | ||
|
|
@@ -56,6 +55,11 @@ | |
| P = ParamSpec("P") | ||
| R = TypeVar("R") | ||
|
|
||
| phetch = Icon( | ||
| src="https://s3.us-east-1.amazonaws.com/publicdata.lastmileai.com/phetch.png", | ||
| mimeType="image/png", | ||
| sizes=["48x48"], | ||
| ) | ||
|
|
||
| class MCPApp: | ||
| """ | ||
|
|
@@ -89,6 +93,7 @@ def __init__( | |
| signal_notification: SignalWaitCallback | None = None, | ||
| upstream_session: Optional["ServerSession"] = None, | ||
| model_selector: ModelSelector | None = None, | ||
| icons: list[Icon] | None = None, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be something configurable on the config as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have to include it as a parameter to the |
||
| session_id: str | None = None, | ||
| ): | ||
| """ | ||
|
|
@@ -140,6 +145,10 @@ def __init__( | |
| self._signal_notification = signal_notification | ||
| self._upstream_session = upstream_session | ||
| self._model_selector = model_selector | ||
| if icons: | ||
| self._icons = icons | ||
| else: | ||
| self._icons = [phetch] | ||
| self._session_id_override = session_id | ||
|
|
||
| self._workflows: Dict[str, Type["Workflow"]] = {} # id to workflow class | ||
|
|
@@ -954,6 +963,8 @@ def decorator(fn: Callable[P, R]) -> Callable[P, R]: | |
| icons_list.append(Icon(**icon)) | ||
| else: | ||
| raise TypeError("icons entries must be Icon or mapping") | ||
| else: | ||
| icons_list = [phetch] | ||
|
|
||
| meta_payload: Dict[str, Any] | None = None | ||
| if meta is not None: | ||
|
|
@@ -1062,6 +1073,8 @@ def decorator(fn: Callable[P, R]) -> Callable[P, R]: | |
| icons_list.append(Icon(**icon)) | ||
| else: | ||
| raise TypeError("icons entries must be Icon or mapping") | ||
| else: | ||
| icons_list = [phetch] | ||
|
|
||
| meta_payload: Dict[str, Any] | None = None | ||
| if meta is not None: | ||
|
|
@@ -1073,6 +1086,7 @@ def decorator(fn: Callable[P, R]) -> Callable[P, R]: | |
| description=description, | ||
| mark_sync_tool=False, | ||
| ) | ||
|
|
||
| # Defer alias tool registration for run/get_status | ||
| self._declared_tools.append( | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example is missing the required import for
Path. Consider addingfrom pathlib import Pathto the code example to ensure users can copy and run it without errors.Spotted by Graphite Agent

Is this helpful? React 👍 or 👎 to let us know.