Skip to content

Conversation

@giuliastf
Copy link
Collaborator

@giuliastf giuliastf commented Dec 12, 2025

This pull request introduces a comprehensive, production-ready sample for a code refactoring assistant agent using LangGraph and the UiPath Python SDK, with strong emphasis on structure, documentation, and extensibility. The main purpose of this pr s to show how can be used the available get_prompt() LanGraph function for MCP servers.

@giuliastf giuliastf self-assigned this Dec 12, 2025
@giuliastf giuliastf force-pushed the feat/prompts_sample branch 4 times, most recently from 0967e2a to 4a0b812 Compare December 15, 2025 22:46
@giuliastf giuliastf requested a review from Copilot December 15, 2025 22:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a sample implementation demonstrating MCP (Model Context Protocol) prompts through a code refactoring assistant. The sample includes an MCP server with tools for analyzing Python code, detecting code smells, and generating structured refactoring guidance using prompts.

Key Changes

  • Adds MCP server with code analysis tools and refactoring prompts
  • Implements LangGraph agent that uses MCP tools to analyze code and select appropriate refactoring strategies
  • Provides comprehensive refactoring guidance for extract method, simplify conditionals, remove duplication, and improve naming patterns

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
uv.lock Adds dependencies for MCP, Anthropic SDK, cryptography, and related packages
pyproject.toml Configures workspace to include new sample project
samples/mcp-refactoring-assistant/pyproject.toml Project configuration with dependencies for MCP, LangChain, and LangGraph
samples/mcp-refactoring-assistant/server.py MCP server exposing tools (complexity analysis, code smell detection, refactoring guide) and prompts
samples/mcp-refactoring-assistant/graph.py LangGraph agent that orchestrates code analysis and refactoring recommendation workflow
samples/mcp-refactoring-assistant/tools/*.py Implementation of code analysis heuristics and refactoring guidance mapping
samples/mcp-refactoring-assistant/prompts/*.py Detailed refactoring prompts with examples and best practices
Configuration files LangGraph config, UiPath config, entry points, and bindings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,169 @@
"""LangGraph agent for Code Refactoring Assistant.
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file starts with a zero-width non-breaking space (BOM) character (). This can cause unexpected parsing issues with some tools and should be removed.

Suggested change
"""LangGraph agent for Code Refactoring Assistant.
"""LangGraph agent for Code Refactoring Assistant.

Copilot uses AI. Check for mistakes.
@giuliastf giuliastf force-pushed the feat/prompts_sample branch 4 times, most recently from ba06bc0 to 5d267e0 Compare December 15, 2025 23:45
@giuliastf giuliastf marked this pull request as ready for review December 15, 2025 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant