GitHub Copilot Agent Mode for the Win: I added a new Tool to MCP Server with Single Prompt


Along with fellow panelists Jason Haley, Veronika Kolesnikova (the three of us run Boston Azure AI), and Udai Ramachandrans (he runs Nashua Cloud .NET & DevBoston), I was part of a Boston Azure AI event to discuss highlights from Microsoft’s 2025 Build conference. I knew a couple of the things I wanted to show off were GitHub Copilot Agent mode and hosting Model Context Protocol (MCP) tools in Azure Functions.

What I didn’t realize at first was that these would be the same demo.

I started with a solid sample C#/.NET MCP server ready to be deployed as an Azure Function (one of several languages offered). The sample implemented a couple of tools and my goal was to implement an additional tool that would accept an IP address and return the country where that IP address is registered. The IP to country code mapping functionality if available as part of Azure Maps.

I started to hand-implement it, then… I decided to see how far GitHub Copilot Agent mode would get me. I’ve used it many times before and it can be helpful, but this ask was tricky. One challenge being that there was IaC in the mix: Bicep files to support the azd up deployment, AVM modules, and many code files implementing the feature set. And MCP is still new. And the MCP support within Azure Functions was newer still.

Table of Contents

Give GitHub Copilot Agent a Goal

The first step was to give the GitHub Copilot Agent a goal that matches my needs. In my case, I gave Agent mode this prompt:

The .NET project implements a couple of Model Context Protocol (MCP) tools – a couple for snippets and one that says hello. Add a new MCP tool that accepts an IPv4 IP address and returns the country where that IP address is registered. For example, passing in 8.8.8.8, which is Google’s well-known DNS server address, would return “us” because it is based in the USA. To look up the country of registration, use the Azure Maps API.

And here’s what happened – as told through some screenshots from what scrolled by in the Agent chat pane – in a sequence that took around 12 minutes:

image 2
image 3

I can see some coding progress along the way:

image 4

A couple of times the Agent paused to see if I wanted to continue:

image 5

It noticed an error and didn’t stop – it just got busy overcoming it:

image 6
image 7

It routinely asked for permissions before certain actions:

image 8

Again, error identification – then overcoming errors, sometimes by getting more up-to-date information:

image 9
image 10

Second check to make sure I was comfortable with it continuing – this one around 10 minutes after starting work on the goal:

image 11

In total 9 files were changed and 11 edit locations were identified:

image 12

Deploy to Azure

Using azd up, get it deployed into Azure.

image 20
image 22

Add MCP Reference to VS Code

Once up and running, then I installed it in VS Code as a new Tool – first click on the wrench/screwdriver:

image 13

Then from the pop-up, scroll the the bottom, then choose + Add More Tools…

image 14

Then follow the prompts (and see also instructions in the GitHub repo):

image 15

Exercise in VS Code

Now that you’ve added the MCP server (running from an Azure Function) into the MCP host (which is VS Code), you can invoke the MCT tool that accepts an IP and returns a country code:

domain-availability-checker% dig A en.kremlin.ru +short
95.173.136.70
95.173.136.72
95.173.136.71
domain-availability-checker%

Using the first of the three returned IP addresses, I ask within the Agent chat area “where is 95.173.136.70 located?” – assuming that the LLM used by the chat parser will recognize the IP address – and the need for a location – and figure out the right MCT tool to invoke:

image 16

I give it one-time permission and it does its thing:

image 17
image 18
image 19

Victory!

Check Code Changes into GitHub

image 21

Of course, using GitHub Copilot to generate a commit message:

image 23

Done!

Connect with Bill and Boston Azure AI


Share this content:

I am a passionate blogger with extensive experience in web design. As a seasoned YouTube SEO expert, I have helped numerous creators optimize their content for maximum visibility.

Leave a Comment