-
-
Save KyMidd/e135373390bac5aae8147d8d47ef298d to your computer and use it in GitHub Desktop.
PagerDuty MCP client setup for the Slack Strands agentic bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def build_pagerduty_mcp_client(pagerduty_api_key, pagerduty_api_url): | |
| """Build PagerDuty MCP client with available tools""" | |
| # Build the PagerDuty MCP client | |
| pagerduty_mcp_client = MCPClient( | |
| server_path="/opt/pagerduty-mcp-server", | |
| server_args=[], | |
| server_env={ | |
| "PAGERDUTY_API_KEY": pagerduty_api_key, | |
| "PAGERDUTY_API_URL": pagerduty_api_url, | |
| }, | |
| ) | |
| # List available tools from the PagerDuty MCP server | |
| available_tools = pagerduty_mcp_client.list_tools() | |
| print(f"🟡 Available PagerDuty MCP tools: {[tool.name for tool in available_tools]}") | |
| # Convert MCP tools to Strands-compatible tools | |
| pagerduty_tools = [ | |
| pagerduty_mcp_client.create_tool(tool) for tool in available_tools | |
| ] | |
| return pagerduty_mcp_client, pagerduty_tools |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment