Home / Directory / Microsoft Learn / microsoft_code_sample_search

Microsoft code sample search

An MCP tool from the Microsoft Learn server, run by Microsoft.

Search for code snippets and examples in official Microsoft Learn documentation. This tool retrieves relevant code samples from Microsoft documentation pages providing developers with practical implementation examples and best practices for Microsoft/Azure products and services related coding tasks. This tool will help you use the **LATEST OFFICIAL** code snippets to empower coding capabilities. ## When to Use This Tool - When you are going to provide sample Microsoft/Azure related code snippets in your answers. - When you are **generating any Microsoft/Azure related code**. ## Usage Pattern Input a descriptive query, or SDK/class/method name to retrieve related code samples. The optional parameter `language` can help to filter results. Eligible values for `language` parameter include: csharp javascript typescript python powershell azurecli al sql java kusto cpp go rust ruby php

Name on the gateway: microsoft_learn__microsoft_code_sample_search.

Parameters

NameTypeDescription
query requiredstringa descriptive query, SDK name, method name or code snippet related to Microsoft/Azure products, services, platforms, developer tools, frameworks, APIs or SDKs
languagestringOptional parameter specifying the programming language of code snippets to retrieve. Can significantly improve search quality if provided. Eligible values: csharp javascript typescript python powershell azurecli al sql java kusto cpp go rust ruby php

How to call it

Through the Smart Gateway, any client can run it by name with call_tool, or let the gateway find it with search_tools:

call_tool arguments
{
  "name": "microsoft_learn__microsoft_code_sample_search",
  "arguments": {
    "query": "…"
  }
}

The first call connects Microsoft Learn to your account automatically; nothing to set up. About this server.

Try asking

Use the microsoft code sample search tool with query set to ….

More from Microsoft Learn