Skip to content

feat: add create_asset and update_asset tools#136

Draft
madincea-doit wants to merge 7 commits into
mainfrom
feat-create-update-asset
Draft

feat: add create_asset and update_asset tools#136
madincea-doit wants to merge 7 commits into
mainfrom
feat-create-update-asset

Conversation

@madincea-doit

@madincea-doit madincea-doit commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

currently blocked by: https://doitintl.atlassian.net/browse/CMP-40849

add create_asset and update_asset tools with request handlers and 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.

…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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_asset and update_asset tool 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.

Comment thread src/tools/assets.ts
- 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/utils/util.ts
Comment thread README.md Outdated
- 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/utils/util.ts Outdated
Comment thread src/tools/assets.ts
…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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/utils/__tests__/util.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants