-
Notifications
You must be signed in to change notification settings - Fork 103
Add stored procedure and function tools with comprehensive test coverage #59
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
Open
shubham070
wants to merge
8
commits into
Azure-Samples:main
Choose a base branch
from
shubham070:feature/implement-procedures-functions-tools
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add stored procedure and function tools with comprehensive test coverage #59
shubham070
wants to merge
8
commits into
Azure-Samples:main
from
shubham070:feature/implement-procedures-functions-tools
Conversation
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
…tools - Add ListProceduresAndFunctions tool to list all stored procedures and functions - Add DescribeProcedureOrFunction tool to get detailed information about procedures/functions - Include parameter information, definitions, and metadata - Both tools follow existing patterns with proper error handling and logging
…cuteFunction tools - Add ToolsUnitTests.cs with 16 fast unit tests covering: * Parameter validation for stored procedures and functions * Constructor and interface validation for Tools class * SqlConnectionFactory interface verification * Various parameter types and null value handling - Add comprehensive test documentation (README.md) explaining: * Separation between unit tests (fast, no dependencies) and integration tests * Test execution commands and prerequisites * Test coverage matrix for all tools * Best practices following Test Pyramid principle - Maintain clean architecture: * Unit tests (16) - Fast validation without database dependencies * Integration tests (14) - End-to-end database testing (unchanged) * Total coverage: 30 tests across all MCP tools This addresses missing test coverage for the ExecuteStoredProcedure and ExecuteFunction tools added in previous commits while maintaining proper separation of concerns between unit and integration testing.
aaron-cui-sh
approved these changes
Aug 7, 2025
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.
@JetterMcTedder or other admins when are y'all gon review some of these open PRs?
@aaron-cui-sh let me go see if I can get someone to review the MCP updates/additions. |
- Add unit tests for CreateProcedure and CreateFunction tools - Test parameter validation and SQL statement validation - Test ExecuteStoredProcedure and ExecuteFunction parameter handling - Test edge cases and error conditions - Follow existing test patterns and conventions
…nd function tools - Document all 13 MCP tools (7 existing + 6 new) - Add detailed testing documentation - Include example usage for procedures and functions - Update tool count from 7 to 13 tools - Add troubleshooting section for new features
git commit -m "Fix compilation errors: Remove invalid 'message' parameter from DbOperationResult constructor - Fixed CreateProcedure.cs line 42 - Fixed CreateFunction.cs line 42 - DbOperationResult constructor only accepts success, error, rowsAffected, data parameters" # Push to the PR branch git push origin feature/implement-procedures-functions-tools
…//github.com/shubham070/SQL-AI-samples into feature/implement-procedures-functions-tools
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 Overview
This PR implements comprehensive support for SQL Server stored procedures and functions in the MCP server, including execution capabilities, metadata retrieval, and robust test coverage.
✨ Features Added
New MCP Tools (6 tools)
ExecuteStoredProcedure
- Execute stored procedures with optional parametersExecuteFunction
- Execute table-valued functions with optional parametersListProceduresAndFunctions
- List all stored procedures and functions in the databaseDescribeProcedureOrFunction
- Get detailed metadata about specific procedures/functionsCreateProcedure
- Creates a new stored procedure in the SQL DatabaseCreateFunction
- -"Creates a new function in the SQL DatabaseComprehensive Test Coverage
🔧 Technical Implementation
Core Features
Architecture Improvements
🧪 Testing Strategy
Unit Tests (
ToolsUnitTests.cs
)