---
name: "xpay-microsoft-learn-microsoft-code-sample-search"
description: "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"
version: "1.0.0"
price: "$0.01/call"
provider: "Microsoft Learn"
---

# Microsoft Code Sample Search

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

**Provider:** Microsoft Learn
**Price:** $0.01/call
**Pricing model:** Flat rate per call

## When to Use

Use this tool when you need to 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. This is part of the Microsoft Learn provider on xpay✦.

## MCP Connection

Connect to xpay✦ to access this tool (and 2+ others):

```json
{
  "mcpServers": {
    "xpay": {
      "url": "https://mcp.xpay.sh/mcp?key=YOUR_API_KEY"
    }
  }
}
```

For Claude Code:
```bash
claude mcp add --transport http xpay "https://mcp.xpay.sh/mcp?key=YOUR_API_KEY"
```

## How to Execute

Use the xpay✦ meta-tools to run this tool:

1. **`xpay_details`** — Get full input schema: `xpay_details("microsoft-learn/microsoft_code_sample_search")`
2. **`xpay_run`** — Execute: `xpay_run("microsoft-learn/microsoft_code_sample_search", { ...inputs })`

## Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `language` | string | No | Optional 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 |
| `query` | string | Yes | a descriptive query, SDK name, method name or code snippet related to Microsoft/Azure products, services, platforms, developer tools, frameworks, APIs or SDKs |

## Pricing

- **Cost:** $0.01/call
- **Balance check:** Use `xpay_balance` to check remaining credits
- Get your API key at [xpay.tools](https://xpay.tools/account/settings/api-keys/) — $5 free credits included

## Related Skills

- [Microsoft Learn (all tools)](https://xpay.tools/skills/microsoft-learn/SKILL.md) — 3 tools
- [Microsoft Docs Search](https://xpay.tools/skills/microsoft-learn/microsoft-docs-search/SKILL.md) — $0.01/call
- [Microsoft Docs Fetch](https://xpay.tools/skills/microsoft-learn/microsoft-docs-fetch/SKILL.md) — $0.01/call

## Links

- Tool page: https://xpay.tools/microsoft-learn/microsoft-code-sample-search/
- Provider: https://xpay.tools/microsoft-learn/
- All tools: https://xpay.tools/explore
