-
Couldn't load subscription status.
- Fork 38
MCP register tools #57
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
1dc0a0f
5c145a3
133c187
a27941e
68b06be
33785d0
677ec11
0887a00
26ba8c3
c685a6e
7c8f0d2
c23b594
1320bf5
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 | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||
| import sys | ||||||
| from typing import Dict, Any, List, Optional, Callable | ||||||
| import aiohttp | ||||||
| import asyncio | ||||||
|
|
@@ -12,6 +13,13 @@ | |||||
|
|
||||||
| logger = logging.getLogger(__name__) | ||||||
|
|
||||||
| if not logger.hasHandlers(): # Only add default handler if user didn't configure logging | ||||||
| handler = logging.StreamHandler(sys.stderr) | ||||||
| handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s")) | ||||||
| logger.addHandler(handler) | ||||||
h3xxit marked this conversation as resolved.
Show resolved
Hide resolved
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. Adding a handler without disabling propagation can cause duplicate log records if root/global handlers are configured later; set propagate=False after adding the default handler. (Based on your team's feedback about plugin logs not showing by default, this keeps the default handler while preventing duplicates when applications also configure logging.) Prompt for AI agents
Suggested change
|
||||||
| logger.setLevel(logging.INFO) | ||||||
h3xxit marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
|
|
||||||
| class GraphQLClientTransport(ClientTransportInterface): | ||||||
| """ | ||||||
| Simple, robust, production-ready GraphQL transport using gql. | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |||||
| - Request/response handling with proper error management | ||||||
| """ | ||||||
|
|
||||||
| import sys | ||||||
| from typing import Dict, Any, List, Optional, Callable, AsyncGenerator | ||||||
| import aiohttp | ||||||
| import json | ||||||
|
|
@@ -36,6 +37,12 @@ | |||||
|
|
||||||
| logger = logging.getLogger(__name__) | ||||||
|
|
||||||
| if not logger.hasHandlers(): # Only add default handler if user didn't configure logging | ||||||
| handler = logging.StreamHandler(sys.stderr) | ||||||
| handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s")) | ||||||
| logger.addHandler(handler) | ||||||
|
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. Adding a handler without disabling propagation can cause duplicate logs when global/root handlers are configured later. Set logger.propagate = False after adding the handler. (Based on your team's feedback about restoring plugin logs by default, this ensures logs are shown without duplication when users later configure global logging.) Prompt for AI agents
Suggested change
|
||||||
| logger.setLevel(logging.INFO) | ||||||
|
|
||||||
| class HttpCommunicationProtocol(CommunicationProtocol): | ||||||
| """REQUIRED | ||||||
| HTTP communication protocol implementation for UTCP client. | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import sys | ||
| from typing import Dict, Any, List, Optional, Callable, AsyncIterator, AsyncGenerator | ||
| import aiohttp | ||
| import json | ||
|
|
@@ -21,6 +22,12 @@ | |
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| if not logger.hasHandlers(): # Only add default handler if user didn't configure logging | ||
| handler = logging.StreamHandler(sys.stderr) | ||
| handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s")) | ||
| logger.addHandler(handler) | ||
|
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. Adding a handler without disabling propagation can produce duplicate log entries if the app configures root/ancestor handlers after this module is imported; disable propagation when installing the default handler. (Based on your team's feedback about restoring plugin logs by adding default logging handlers.) Prompt for AI agents |
||
| logger.setLevel(logging.INFO) | ||
h3xxit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| class SseCommunicationProtocol(CommunicationProtocol): | ||
| """REQUIRED | ||
| SSE communication protocol implementation for UTCP client. | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |
| import json | ||
| import socket | ||
| import struct | ||
| import sys | ||
| from typing import Dict, Any, List, Optional, Callable, Union | ||
|
|
||
| from utcp.client.client_transport_interface import ClientTransportInterface | ||
|
|
@@ -16,6 +17,12 @@ | |
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| if not logger.hasHandlers(): # Only add default handler if user didn't configure logging | ||
| handler = logging.StreamHandler(sys.stderr) | ||
| handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s")) | ||
| logger.addHandler(handler) | ||
|
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. Adding a handler without disabling propagation can cause duplicate logs when global handlers are configured later; set logger.propagate = False when installing the default handler. (Based on your team's feedback about restoring plugin logs by default; this keeps logs visible without duplicating them when global logging is configured.) Prompt for AI agents |
||
| logger.setLevel(logging.INFO) | ||
h3xxit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| class TCPTransport(ClientTransportInterface): | ||
| """Transport implementation for TCP-based tool providers. | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |||||
| tools. It does not maintain any persistent connections. | ||||||
| """ | ||||||
| import json | ||||||
| import sys | ||||||
| import yaml | ||||||
| import aiofiles | ||||||
| from pathlib import Path | ||||||
|
|
@@ -25,6 +26,13 @@ | |||||
|
|
||||||
| logger = logging.getLogger(__name__) | ||||||
|
|
||||||
| if not logger.hasHandlers(): # Only add default handler if user didn't configure logging | ||||||
| handler = logging.StreamHandler(sys.stderr) | ||||||
| handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s")) | ||||||
| logger.addHandler(handler) | ||||||
|
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. Adding a handler at import time without disabling propagation can cause duplicate logs if the application configures handlers later; set logger.propagate = False when attaching the default handler. (Based on your team's feedback about restoring plugin logs by default, this change keeps logs visible while preventing duplicates after later logging configuration.) Prompt for AI agents
Suggested change
|
||||||
| logger.setLevel(logging.INFO) | ||||||
|
|
||||||
|
|
||||||
| class TextCommunicationProtocol(CommunicationProtocol): | ||||||
| """REQUIRED | ||||||
| Communication protocol for file-based UTCP manuals and tools.""" | ||||||
|
|
||||||
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.
Adding a handler without disabling propagation can cause duplicate logs if global handlers are configured later; set propagate=False when attaching the default handler.
(Based on your team's feedback about restoring plugin logs by default, this ensures logs show once without duplication when apps later configure logging.)
Prompt for AI agents