Skip to content

Conversation

@IshitaBadole
Copy link
Contributor

@IshitaBadole IshitaBadole commented Sep 17, 2025

  • Add Load Balancer tools to the networking tools stack.
  • Add corresponding test cases.
  • Update the networking registry to include load balancer tools.
  • Update mockgen command for generating mocks and updated mocks.
  • Update networking services README with descriptions for the load balancer tools.

Tools have been locally tested using mcp inspector.
Verified tests are passing with make test.

Comment on lines +77 to +84
lbType, _ := args["Type"].(string)
network, _ := args["Network"].(string)
sizeUnit, _ := args["SizeUnit"].(float64)
networkStack, _ := args["NetworkStack"].(string)
projectID, _ := args["ProjectID"].(string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we be validating each field here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These fields are optional so I don't think validation is necessary. I'll add a comment for clarity.

FailoverThreshold: uint32(failoverThreshold),
}
}
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it accepted to assume that the LLM will provide either GLOBAL or default to REGIONAL?

I think we may need to be explicit in our check here:

Perhaps check if either GLOBAL, REGIONAL or fallback to a default case which returns an error.

Copy link
Contributor Author

@IshitaBadole IshitaBadole Sep 24, 2025

Choose a reason for hiding this comment

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

if type is not provided, the api defaults to the regional type. So, if type is not provided, all the other args will be used to create regional type load balancer. Maybe I could add the defaults in the descriptions of the fields?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's a sensible option

{
Handler: l.createLoadBalancer,
Tool: mcp.NewTool("load-balancer-create",
mcp.WithDescription("Create a new Load Balancer"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

For complex structs, I'd suggest using schema generation. See apps/specs/ and apps-create-app-from-spec as an example

Comment on lines +559 to +618
mcp.WithString("LoadBalancerID", mcp.Required(), mcp.Description("ID of the load balancer")),
mcp.WithString("Name", mcp.Required(), mcp.Description("Name of the load balancer")),
mcp.WithString("Region", mcp.Description("Region slug (e.g., nyc3)")),
mcp.WithArray("DropletIDs", mcp.Description("IDs of the Droplets assigned to the load balancer")),
mcp.WithString("Tag", mcp.Description("Droplet tag corresponding to Droplets assigned to the load balancer")),
mcp.WithArray("ForwardingRules", mcp.Description("Forwarding rules for a load balancer")),
mcp.WithString("Type", mcp.Required(), mcp.Description("Type of the load balancer (REGIONAL, REGIONAL_NETWORK, GLOBAL)")),
mcp.WithString("Network", mcp.Description("Network type of the load balancer (EXTERNAL, INTERNAL)")),
mcp.WithNumber("SizeUnit", mcp.DefaultNumber(2), mcp.Description("Size of the load balancer in units appropriate to its type")),
mcp.WithString("NetworkStack", mcp.Description("Network stack of the load balancer (IPV4, DUALSTACK)")),
mcp.WithString("ProjectID", mcp.Description("Project ID to which the load balancer will be assigned")),
mcp.WithArray("TargetLoadBalancerIDs", mcp.Description("IDs of the target regional load balancers for a global load balancer")),
mcp.WithObject("GLBSettings", mcp.Description("Forward configurations for a global load balancer")),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment about generating this type instead.

@IshitaBadole IshitaBadole force-pushed the LBAAS-4091-add-load-balancer-tools branch 3 times, most recently from 055d3bb to 67eabc7 Compare September 25, 2025 00:39
@ssaengs
Copy link
Collaborator

ssaengs commented Oct 21, 2025

@IshitaBadole, could you fix the conflicts before I merge this one?

@IshitaBadole IshitaBadole force-pushed the LBAAS-4091-add-load-balancer-tools branch from 0c4bfe7 to 4e34658 Compare October 22, 2025 19:39
@IshitaBadole
Copy link
Contributor Author

@IshitaBadole, could you fix the conflicts before I merge this one?

Hi, I've rebased my changes

@ssaengs
Copy link
Collaborator

ssaengs commented Oct 23, 2025

There's one conflict I see. I think this can be solved by re-generating mocks.go within networking.

@IshitaBadole IshitaBadole force-pushed the LBAAS-4091-add-load-balancer-tools branch from 4e34658 to 2f4e394 Compare October 24, 2025 19:36
@IshitaBadole
Copy link
Contributor Author

There's one conflict I see. I think this can be solved by re-generating mocks.go within networking.

Thanks I missed that. It's updated now.

@ssaengs ssaengs merged commit 9b8b32c into digitalocean-labs:main Oct 24, 2025
4 checks passed
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