MCP server refinement#168
Merged
Merged
Conversation
This is an enum.Enum subclass. There should be no downstream impact. Signed-off-by: Chris PeBenito <pebenito@ieee.org>
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
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
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.
This pull request refactors several parts of the
setoolscodebase, primarily to improve enum handling, standardize JSON serialization, and simplify component selection logic for policy difference analysis. It also updates tests to align with these changes. The main themes are improved enum usage, serialization consistency, and code simplification.Enum and Component Handling Improvements:
enum.Enumwith a custompolicyrep.PolicyEnumforModeinner classes in bothDomainTransitionAnalysisandInfoFlowAnalysis, improving consistency and enabling custom lookup methods.DiffComponentenum to replace the previous frozenset of string constants for policy component selection in difference analysis, resulting in more robust and type-safe component handling throughoutsetools/mcp/server.py.JSON Serialization and API Response Standardization:
_serialize_results, which is now used throughout the server for consistent formatting and reduced code duplication.Analysis Method Simplification:
setools_analyze_dtaandsetools_analyze_info_flowby leveraging the new enum lookup method, and adjusted references to analysis mode to use the new enum instances.DiffComponentenum for component selection and improved the logic for default and user-specified components.Test Updates:
tests/library/mcp/test_server.pyto match the new standardized API response format and removed now-unnecessary argument for top-level key count.Other Minor Cleanups: