feat: Add DON ID type validation and Rev Orgs service (CUSS-396, CUSS-397)#207
Draft
mgmonteleone wants to merge 1 commit intomainfrom
Draft
feat: Add DON ID type validation and Rev Orgs service (CUSS-396, CUSS-397)#207mgmonteleone wants to merge 1 commit intomainfrom
mgmonteleone wants to merge 1 commit intomainfrom
Conversation
CUSS-396: Add DON ID type validation with helpful error messages - Create src/devrev_mcp/utils/don_id.py with parse_don_type and validate_don_id - Integrate validation into all 14 MCP tool files (_get, _update, _delete ops) - Provides clear error messages when wrong ID type is used (e.g. rev_org ID passed to accounts_get) with tool suggestions CUSS-397: Add Rev Orgs (revenue organizations) service - Create Rev Orgs Pydantic v2 models (RevOrg, RevOrgSummary, request/response) - Implement sync RevOrgsService and async AsyncRevOrgsService - Register services in DevRevClient and AsyncDevRevClient - Create MCP tools: list, get, create, update, delete - 41 new unit tests (22 for DON ID validation, 19 for Rev Orgs) - All 1091 tests pass
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.
Overview
This PR implements two related enhancements to improve the DevRev MCP tools and SDK:
Problem
Users were getting generic "Validation error: Bad Request" when passing the wrong type of DON ID to MCP tools (e.g., passing a rev_org ID
revo/...todevrev_accounts_getwhich expects an account IDaccount/...). Additionally, there was no way to look up rev_orgs directly.What Changed
CUSS-396: DON ID Type Validation
New file:
src/devrev_mcp/utils/don_id.pyparse_don_type(don_id)— extracts the object type segment from a DON IDvalidate_don_id(don_id, expected_types, tool_name)— soft-validates DON IDs with clear error messagesDON_TYPE_MAP— maps DON type segments to human-friendly namesTOOL_SUGGESTIONS— maps DON types to the correct MCP tool for helpful suggestionsModified: 14 MCP tool files — added
validate_don_id()calls to all_get,_update,_deleteoperations:accounts.py,articles.py,conversations.py,engagements.py,groups.py,incidents.py,links.py,parts.py,question_answers.py,slas.py,tags.py,timeline.py,users.py,works.pyExample error message:
CUSS-397: Rev Orgs Service
New files:
src/devrev/models/rev_orgs.py— Pydantic v2 models (RevOrg, RevOrgSummary, request/response models)src/devrev/services/rev_orgs.py— SyncRevOrgsServiceand asyncAsyncRevOrgsServicesrc/devrev_mcp/tools/rev_orgs.py— MCP tools (list, get, create, update, delete)Modified:
src/devrev/client.py— Addedrev_orgsproperty to both clientssrc/devrev/models/__init__.py— Exported rev_orgs modelssrc/devrev/services/__init__.py— Exported rev_orgs servicessrc/devrev_mcp/server.py— Registered rev_orgs toolsTesting
tests/unit/test_don_id_validation.py)tests/unit/test_rev_orgs.py)Deployment Notes
enable_destructive_toolsconfig flagRelated Issues
Pull Request opened by Augment Code with guidance from the PR author