Skip to content

Adding tool to fetch the public IP for databases, plus some small fixes in descriptions#107

Open
shyam2511 wants to merge 1 commit intooracle:mainfrom
shyam2511:database-mcp-changes
Open

Adding tool to fetch the public IP for databases, plus some small fixes in descriptions#107
shyam2511 wants to merge 1 commit intooracle:mainfrom
shyam2511:database-mcp-changes

Conversation

@shyam2511
Copy link
Member

@shyam2511 shyam2511 commented Jan 7, 2026

Description

Adding tool to fetch the public IP for databases, plus some small fixes in descriptions.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jan 7, 2026
@shyam2511 shyam2511 force-pushed the database-mcp-changes branch 2 times, most recently from 030c3ed to 6b3fcd0 Compare January 7, 2026 08:55
freeform_tags: Optional[str] = Field(
freeform_tags: Optional[dict] = Field(
None,
description='Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see `Resource Tags`__. Example: `{"Department": "Finance"}` __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm',
Copy link
Member

Choose a reason for hiding this comment

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

Any examples should be in the examples argument. See https://docs.pydantic.dev/2.0/api/fields/#pydantic.fields.Field

Copy link
Member Author

Choose a reason for hiding this comment

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

This model is a pojo that is never visible to the agent, hence the description shouldn't matter here

return map_pluggabledatabase(response.data)


def get_public_ip_for_db(database_id, region=None):
Copy link
Member

Choose a reason for hiding this comment

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

Can we add unit tests for these changes

Copy link
Member Author

Choose a reason for hiding this comment

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

Added the tests.


try:
# Fetch VNIC details
get_vnic_response = virtual_network_client.get_vnic(node.vnic_id)
Copy link
Member

Choose a reason for hiding this comment

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

We already have a tool in the networking mcp server called get_vnic. Is it worth it to just use that instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

We require this tool to be in our server itself, that's why we have added it. Otherwise the user will have to install both servers, and the agent would have no way to know how to actually get the public IPs even when given these tools

@shyam2511 shyam2511 force-pushed the database-mcp-changes branch from 6b3fcd0 to 2a33f60 Compare January 9, 2026 09:41
@shyam2511 shyam2511 force-pushed the database-mcp-changes branch from 2a33f60 to 1a7c01c Compare February 17, 2026 10:14
@shyam2511 shyam2511 changed the title Adding feature to replace the host ip with public ip in get/list pluggable databases Adding tool to fetch the public IP for databases, plus some small fixes in descriptions Feb 17, 2026
@shyam2511 shyam2511 requested a review from cboffa13 February 18, 2026 17:08
Copy link
Member

@gebhardtr gebhardtr left a comment

Choose a reason for hiding this comment

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

Needs a version bump; but please consider a slight refactor based on comments.

@@ -312,11 +312,107 @@ def call_create_pdb(client, details, opc_retry_token=None, opc_request_id=None):
return map_pluggabledatabase(response.data)


@mcp.tool(
description="Fetches the public IP address for a specified Database. For a Pluggable Database, use it's container database id as input"
Copy link
Member

@gebhardtr gebhardtr Mar 12, 2026

Choose a reason for hiding this comment

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

nit:

Suggested change
description="Fetches the public IP address for a specified Database. For a Pluggable Database, use it's container database id as input"
description="Fetches the public IP address for a specified Database. For a Pluggable Database, use its container database id as input"

token = f.read()
signer = oci.auth.signers.SecurityTokenSigner(token, private_key)

virtual_network_client = oci.core.VirtualNetworkClient(config, signer=signer)
Copy link
Member

Choose a reason for hiding this comment

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

An advantage of doing it this ways it that you save tokens (and an LLM roundtrip), but this separation of concerns violation complicates your server and will require additional updates when we add support for Oauth and other authentication approaches.

Have you considered changing this tool to return the DB nodes (with VNIC attribute) and allow the model to invoke the correct tool (in the networking server) to find the public IP for the VNIC?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants