Skip to content

Conversation

@jiapingzeng
Copy link
Contributor

@jiapingzeng jiapingzeng commented Oct 27, 2025

Description

Support MCP connector in agent update API

Related Issues

Resolves #4321

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.


Scenarios tested:

initial agent parameters:

{
  "_llm_interface": "bedrock/converse/claude",
  "mcp_connectors": "[{\"mcp_connector_id\":\"initial-connector-123\",\"tool_filters\":[\"^get_.*$\"]}]"
}
  1. Update connector filters:
PUT /_plugins/_ml/agents/{{agent_id}}
{
    "parameters": {
        "mcp_connectors": [{
            "mcp_connector_id": "updated-connector-456",
            "tool_filters": ["^list_.*$"]
        }]
    }
}

GET /_plugins/_ml/agents/{{agent_id}}
...
{
  "_llm_interface": "bedrock/converse/claude",
  "mcp_connectors": "[{\"mcp_connector_id\":\"updated-connector-456\",\"tool_filters\":[\"^list_.*$\"]}]"
}
  1. Remove connector
PUT /_plugins/_ml/agents/{{agent_id}}
{
    "parameters": {
        "mcp_connectors": []
    }
}

GET /_plugins/_ml/agents/{{agent_id}}
...
{
  "_llm_interface": "bedrock/converse/claude",
  "mcp_connectors": "[]"
}
  1. Add connector to agent without connector
PUT /_plugins/_ml/agents/{{agent_id}}
{
    "parameters": {
        "mcp_connectors": [{
            "mcp_connector_id": "newly-added-connector-789",
            "tool_filters": ["^search_.*$"]
        }]
    }
}

GET /_plugins/_ml/agents/{{agent_id}}
{
  "_llm_interface": "bedrock/converse/claude",
  "mcp_connectors": "[{\"mcp_connector_id\":\"newly-added-connector-789\",\"tool_filters\":[\"^search_.*$\"]}]"
}

Signed-off-by: Jiaping Zeng <jpz@amazon.com>
@jiapingzeng jiapingzeng force-pushed the update-agent-mcp-connector branch from bb83d6c to 5d15ce9 Compare October 27, 2025 17:59
@jiapingzeng jiapingzeng had a problem deploying to ml-commons-cicd-env-require-approval October 27, 2025 18:01 — with GitHub Actions Error
@jiapingzeng jiapingzeng had a problem deploying to ml-commons-cicd-env-require-approval October 27, 2025 18:01 — with GitHub Actions Error
@jiapingzeng jiapingzeng had a problem deploying to ml-commons-cicd-env-require-approval October 27, 2025 18:01 — with GitHub Actions Failure
@jiapingzeng jiapingzeng had a problem deploying to ml-commons-cicd-env-require-approval October 27, 2025 18:01 — with GitHub Actions Failure
@jiapingzeng jiapingzeng marked this pull request as ready for review October 27, 2025 18:26
@jiapingzeng
Copy link
Contributor Author

jiapingzeng commented Oct 27, 2025

Test failure is not related to my change:

> Could not GET 'https://ci.opensearch.org/ci/dbc/snapshots/maven/commons-codec/commons-codec/1.19.0/commons-codec-1.19.0.pom'. Received status code 503 from server: Service Unavailable

Will run build locally to verify.

Edit: succeeds locally

Copy link
Contributor

@rithin-pullela-aws rithin-pullela-aws left a comment

Choose a reason for hiding this comment

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

Thanks for the PR JP!

@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval October 27, 2025 20:19 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval October 27, 2025 20:19 — with GitHub Actions Inactive
@jiapingzeng jiapingzeng had a problem deploying to ml-commons-cicd-env-require-approval October 27, 2025 20:19 — with GitHub Actions Failure
@jiapingzeng jiapingzeng temporarily deployed to ml-commons-cicd-env-require-approval October 27, 2025 20:19 — with GitHub Actions Inactive
@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.06%. Comparing base (305cb8e) to head (5d15ce9).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4352      +/-   ##
============================================
- Coverage     80.09%   80.06%   -0.03%     
+ Complexity    10199    10185      -14     
============================================
  Files           855      855              
  Lines         44373    44374       +1     
  Branches       5135     5135              
============================================
- Hits          35539    35529      -10     
- Misses         6670     6680      +10     
- Partials       2164     2165       +1     
Flag Coverage Δ
ml-commons 80.06% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ylwu-amzn ylwu-amzn merged commit 5964268 into opensearch-project:main Oct 27, 2025
15 of 21 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 27, 2025
Signed-off-by: Jiaping Zeng <jpz@amazon.com>
(cherry picked from commit 5964268)
ylwu-amzn pushed a commit that referenced this pull request Oct 28, 2025
Signed-off-by: Jiaping Zeng <jpz@amazon.com>
(cherry picked from commit 5964268)
ylwu-amzn pushed a commit that referenced this pull request Oct 28, 2025
(cherry picked from commit 5964268)

Signed-off-by: Jiaping Zeng <jpz@amazon.com>
Co-authored-by: Jiaping Zeng <jpz@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Update agent API fails for several scenarios with MCP connectors

5 participants