feat: add create_asset and update_asset tools#136
Conversation
…nd tests - Introduced `create_asset` tool to create new customer assets (e.g., AWS accounts) and `update_asset` tool to modify existing assets, including license adjustments. - Implemented request handlers and input schemas for both tools, ensuring proper validation and error handling. - Updated README documentation to include new tools and their usage. - Added comprehensive tests to verify functionality and error handling for asset creation and updates.
There was a problem hiding this comment.
Pull request overview
This PR adds two new Assets-related MCP tools—create_asset and update_asset—including request handlers, schemas, mocked API integration support, and test coverage, and wires them into the server/tool routing so they’re available to MCP clients.
Changes:
- Added
create_assetandupdate_assettool definitions, argument schemas, and request handlers. - Wired the new tools into tool execution/routing and MCP tool registration.
- Extended integration/unit tests and mocked API fixtures/handlers; updated README tool list.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/integration/stdio/tools.test.ts | Adds integration coverage for create_asset/update_asset and includes them in the advertised tool list. |
| test/integration/mockedDoitApi/index.ts | Mocks POST createAsset and PATCH asset update endpoints for integration tests. |
| test/integration/fixtures/index.ts | Exposes new billing fixtures (createAsset, updateAsset) for mocked API handlers. |
| test/integration/fixtures/billing.ts | Adds fixture payloads for create/update asset responses. |
| src/utils/toolsHandler.ts | Routes create_asset and update_asset tool calls to the new handlers. |
| src/types/assets.ts | Introduces CreateAssetResponse and UpdateAssetResponse types. |
| src/tools/assets.ts | Implements new tool schemas/metadata and request handlers for create/update asset. |
| src/tools/tests/assets.test.ts | Adds unit tests for the new handlers (success paths + validation/error handling). |
| src/server.ts | Registers the new tools with the MCP server and exports the new handlers. |
| src/tests/server.test.ts | Ensures server tool registration and call routing includes the new tools/handlers. |
| doit-mcp-server/src/index.ts | Registers the new tools/schemas for the agent implementation. |
| README.md | Documents the two new tools in the Tools list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Modified the `makeDoitRequest` function to conditionally append the `customerContext` and `mcp` parameters based on the `appendParams` flag. - Updated the `handleCreateAssetRequest` function to set `appendParams` to false, ensuring that the `customerContext` is included in the request URL without additional parameters. - Enhanced tests for `handleCreateAssetRequest` and added new tests for `appendUrlParameters` and `makeDoitRequest` to verify the correct behavior with the updated logic.
- Removed the customerContext parameter from the appendUrlParameters function, focusing on appending only the maxResults parameter. - Updated related tests to reflect the changes, ensuring that maxResults is added correctly and customerContext is handled separately in makeDoitRequest. - Enhanced test cases to verify behavior when maxResults is already present in the URL.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Clarified the description for the `appendParams` option to specify that it controls the appending of the default `maxResults` parameter, while noting that `customerContext`, `mcp`, and `sse` are always appended regardless of this flag.
- Updated the link for the `update_asset` tool in the README documentation to point to the correct reference URL, ensuring accurate information for users.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…function - Updated the documentation for the `appendParams` option to clarify its role in appending the default `maxResults` query parameter, specifying the conditions under which `customerContext`, `mcp`, and `sse` are appended. This improves understanding for users regarding the behavior of the function.
- Added the `appendParams: false` option to the `makeDoitRequest` call within the `handleUpdateAssetRequest` function to control parameter appending behavior. - Updated related tests to verify that the `appendParams` option is correctly passed in the request, ensuring consistent behavior across asset update requests.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
currently blocked by: https://doitintl.atlassian.net/browse/CMP-40849
add create_asset and update_asset tools with request handlers and tests
create_assettool to create new customer assets (e.g., AWS accounts) andupdate_assettool to modify existing assets, including license adjustments.