Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
Redmond desk3 min

Building an AI Assistant in C# Without Rewriting Every Tool: Microsoft.Extensions.AI vs. MCP

Use Microsoft.Extensions.AI to swap model providers and the official MCP C# SDK to share tools across hosts. Here is how they differ and combine.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep your tool logic separate from the model provider, then pick the seam that matches what you want to reuse. If you want to swap models (Azure OpenAI, OpenAI, Ollama) without touching your tools, use Microsoft.Extensions.AI. If you want the same tools to work across different AI hosts and applications, expose them through an MCP server built with the official C# SDK. The two compose well. Neither one removes the work of implementing, authorizing and operating the tool itself.

What tool calling actually is

The model never runs your .NET method. It returns a structured request naming a tool and its arguments, your application invokes the tool, and the result goes back to the model, which continues until it can answer. Microsoft’s AI tool calling documentation for .NET states the safety consequence plainly: “Models might hallucinate arguments that weren’t described in your function definitions.” Validate arguments inside every tool, whichever integration route you take.

As an Amazon Associate I earn from qualifying purchases.

Two different portability problems

Question Seam to use Where tools run
“I may change model providers.” Microsoft.Extensions.AI function calling In-process, inside your app
“Other hosts or apps should use the same tools.” MCP server plus MCP clients Separate server process or remote service
“Both.” MCP client tools fed into Microsoft.Extensions.AI Mixed

Option 1: Microsoft.Extensions.AI for provider independence

Microsoft.Extensions.AI abstracts .NET interactions with AI providers. Per the Microsoft Learn guide to .NET AI and MCP, its function-calling pieces are:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • AIFunction: a described function the model can request.
  • AIFunctionFactory: wraps an existing .NET method as an AIFunction, so you don’t rewrite the method.
  • FunctionInvokingChatClient: automates the loop of invoking requested functions, returning results and continuing until a final answer.

Microsoft lists Azure OpenAI, OpenAI and Ollama among the implementations. Your tool methods stay the same when you change the underlying chat client. Capabilities still vary by model and provider, so check that your chosen model supports function calling at all.

Keep the tools provider-neutral

  • Write tools as plain methods with clear parameter names and descriptions, with no provider SDK types in signatures.
  • Register them through AIFunctionFactory at the edge of your app.
  • Put authorization and argument validation inside the tool, not in the prompt.

Mind the token cost

Tool definitions count toward the model’s token limit. Microsoft suggests registering fewer tools, shortening names and descriptions, and offering only tools relevant to the conversation. Parallel calls are handled by FunctionInvokingChatClient only when the underlying model supports them, so check your provider’s documentation rather than assuming it.

Option 2: MCP for reuse across hosts

The Model Context Protocol standardizes a different boundary. Its architecture has a host, MCP clients and MCP servers, and clients can list and call a server’s tools. The official MCP C# SDK supports building both .NET clients and servers. A tool exposed once as an MCP server can be discovered by any compliant host, and your own assistant can consume it as a client and hand the discovered tools to the model through Microsoft.Extensions.AI.

Package roles

The SDK repository describes these packages:

Package Use it for
ModelContextProtocol.Core Clients and low-level APIs
ModelContextProtocol Most servers, with hosting and dependency injection
ModelContextProtocol.AspNetCore HTTP-based MCP servers
Apps and Tasks extensions Separate, more specialized packages

The repository is rolling documentation, so confirm current package versions and install guidance there before copying commands from any article.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Version-sensitive details

Microsoft’s announcement of v2.0 of the SDK describes stateless behavior as the default and says v2 prefers protocol revision 2026-07-28, while retaining down-level behavior in stated cases. It lists targets of net8.0, net9.0, net10.0 and netstandard2.0, and calls out migration differences for anyone using the experimental Tasks feature. In the post, Microsoft Engineering Manager Jeff Handley wrote: “The 2.0 release of the MCP C# SDK is a milestone for building MCP servers and clients on .NET.” These details were current as of this article’s October 2026 writing. Read the release notes for the version you install.

What MCP costs you

MCP adds a protocol, a transport choice, server lifecycle management and authorization decisions. Local function calling keeps execution in your process, with less to run. MCP does not mean “write once, works everywhere”: tool semantics, permissions, provider capabilities and server operations still need deliberate design.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How to choose

  1. One app, may switch models: use Microsoft.Extensions.AI and AIFunctionFactory only.
  2. Several apps or third-party hosts need the same tools: wrap the tools in an MCP server, using the ASP.NET Core package for HTTP.
  3. Your assistant must also use tools others publish: add an MCP client and pass the discovered tools to your chat client.
  4. Many tools: filter by conversation relevance to limit token use.

A sensible path is to start in-process. Because the tools are plain methods, moving them behind an MCP server later is a packaging change, not a rewrite.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.