Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modelcontextprotocol/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from fastmcp.server.middleware import Middleware, MiddlewareContext
from fastmcp.exceptions import ToolError
import logging
from client import get_atlan_client

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -100,6 +101,15 @@ async def on_call_tool(self, context: MiddlewareContext, call_next):

# Tool is allowed, proceed with execution
logger.debug(f"Tool access granted: {tool_name}", tool=tool_name)
try:
client = get_atlan_client()
client.update_headers({"x-atlan-package-name": tool_name})
Comment thread
abhinavmathur-atlan marked this conversation as resolved.
Outdated
Comment thread
abhinavmathur-atlan marked this conversation as resolved.
Outdated
except Exception:
logger.warning(
"Could not set x-atlan-package-name header",
tool=tool_name,
exc_info=True,
)

return await call_next(context)

Expand Down