Repository navigation
AIML-303 Part 6: Standardize tool architecture naming and composition [STACKED] - #56
Merged
Merged
Conversation
ChrisEdwards
marked this pull request as ready for review
December 24, 2025 08:53
ChrisEdwards
force-pushed
the
AIML-303-6-cache-sdk-instance
branch
from
January 2, 2026 17:04
c9c8250 to
7315bdd
Compare
ChrisEdwards
force-pushed
the
AIML-303-7-tool-architecture-refactor
branch
from
January 2, 2026 17:04
8d88aa6 to
875761b
Compare
JacobMagesHaskinsContrast
approved these changes
Jan 5, 2026
ChrisEdwards
force-pushed
the
AIML-303-6-cache-sdk-instance
branch
from
January 6, 2026 17:24
7315bdd to
53f3b17
Compare
ChrisEdwards
force-pushed
the
AIML-303-7-tool-architecture-refactor
branch
from
January 6, 2026 17:25
875761b to
241c594
Compare
dougj-contrast
approved these changes
Jan 6, 2026
ChrisEdwards
force-pushed
the
AIML-303-6-cache-sdk-instance
branch
from
January 7, 2026 00:12
53f3b17 to
b1cfc25
Compare
- Rename response classes for clarity: - PaginatedResponse → PaginatedToolResponse - ToolResponse → SingleToolResponse - Rename base classes to align with response types: - BaseMcpTool → BasePaginatedTool - BaseGetTool → BaseSingleTool - Extract shared code into BaseContrastTool: - getContrastSDK() and getOrgId() helper methods - mapHttpErrorCode() for HTTP error mapping - Use composition for params validation: - Create BaseToolParams for ToolParams boilerplate - Migrate all 13 params classes from inheritance to composition - Add errorIf() method to ToolValidationContext - All 551 tests pass
ChrisEdwards
force-pushed
the
AIML-303-7-tool-architecture-refactor
branch
from
January 7, 2026 00:14
241c594 to
67723fc
Compare
ChrisEdwards
changed the base branch from
AIML-303-6-cache-sdk-instance
to
main
January 7, 2026 00:14
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 is a stacked PR based on #55. Please review and merge #55 first, then rebase this PR onto
mainbefore merging.Dependency Context:
This PR builds on PR #55 which cached the ContrastSDK instance. With the SDK caching in place, this PR refactors the tool architecture for consistent naming and reduced code duplication.
Why
The MCP tool architecture had inconsistent naming and duplicated code across base classes:
PaginatedResponsevsToolResponse)BaseMcpToolvsBaseGetTool)ToolValidationContextinstead of compositionWhat
PaginatedResponse→PaginatedToolResponse,ToolResponse→SingleToolResponseBaseMcpTool→BasePaginatedTool,BaseGetTool→BaseSingleToolBaseContrastTool: Extracted shared code (SDK access, HTTP error mapping)BaseToolParams: Enables composition pattern for all 13 params classesHow
New Class Hierarchy
Params Composition Pattern
Before (inheritance):
After (composition):
Step-by-Step Walkthrough
Response classes (
tool/base/):PaginatedResponsefromdata/totool/base/PaginatedToolResponseToolResponsetoSingleToolResponseBase classes (
tool/base/):BaseMcpTool→BasePaginatedToolBaseGetTool→BaseSingleToolNew
BaseContrastTool(tool/base/):getContrastSDK(),getOrgId(),mapHttpErrorCode()BaseContrastToolNew
BaseToolParams(tool/base/):ToolParamsinterface with boilerplateerrorIf()method toToolValidationContextfor compositionTesting
BaseMcpToolTest→BasePaginatedToolTest,BaseGetToolTest→BaseSingleToolTest, etc.BaseContrastToolTestwith parameterized HTTP error mapping testsFiles Changed