Skip to content
Agentmart
Submit a tool

add-knowledge

Add a knowledge source (public website or SharePoint) to a Copilot Studio agent.

Skill by microsoftOfficial

IndexedMIT★ 482
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/microsoft-add-knowledge

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Add a knowledge source (public website or SharePoint) to a Copilot Studio agent. Use when the user asks to add a knowledge source, documentation URL, website, or SharePoint site for the agent to search.

Use cases: agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/add-knowledge

Tools it pre-approves 6

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Bash(node
  • *schema-lookup.bundle.js
  • *),
  • Read,
  • Write,
  • Glob

What's inside

Skill name
add-knowledge
Description
Add a knowledge source (public website or SharePoint) to a Copilot Studio agent. Use when the user asks to add a knowledge source, documentation URL, website, or SharePoint site for the agent to search.
License
MIT
Allowed tools
Bash(node, *schema-lookup.bundle.js, *),, Read,, Write,, Glob
Instructions
141 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Agent Skills spec issues

  • name: missing

Files (2)

  • SKILL.md
  • knowledge-guide.md

SKILL.md (first lines)

# Add Knowledge Source

Add a knowledge source to the agent. Supports **Public Website**, **SharePoint**, and **Custom API** sources.

## Instructions

1. **Auto-discover the agent directory**:
   ```
   Glob: **/agent.mcs.yml
   ```
   NEVER hardcode an agent name.

2. **Parse the arguments** to extract:
   - URL
   - Name / description (optional)

3. **Determine the source type** from the user's request:
   - If the URL contains `sharepoint.com` → use `SharePointSearchSource` (but first normalize the URL — see below)
   - If the user wants to connect a **custom search API or database** → use `OnKnowledgeRequested` (see Custom API section below)
   - Otherwise → use `PublicSiteSearchSource`

4. **If SharePoint: normalize the URL** before using it. Copilot Studio requires a direct folder path like:
   `https://contoso.sharepoint.com/sites/MySite/Shared%20Documents/MyFolder`

   Users often paste URLs in other formats. Handle them as follows:

   | URL pattern | Example | Action |
   |---|---|---|
   | **Direct path** (`/sites/.../Shared%20Documents/...`) | `https://x.sharepoint.com/sites/Site/Shared%20Documents/Folder` | **Use as-is** — this is the correct format |
   | **AllItems.aspx with `?id=` param** (`...AllItems.aspx?id=...`) | `https://x.sharepoint.com/.../AllItems.aspx?id=%2Fsites%2FSite%2FShared%20Documents%2FFolder&viewid=...` | **Extract and decode** the `id` query parameter. URL-decode it to get the path (e.g. `/sites/Site/Shared%20Documents/Folder`), then prepend the origin (`https://x.sharepoint.com`) to build the direct path. Drop all query parameters (`?id=`, `&viewid=`, etc.) |
   | **Sharing link** (`/:f:/s/...` or `/:x:/s/...`) | `https://x.sharepoint.com/:f:/s/Site/EncodedToken?e=abc` | **Cannot convert** — these are opaque sharing tokens with no extractable folder path. Ask the user: *"That's a SharePoint sharing link — I can't extract the folder path from it. Could you navigate to the folder in SharePoint, copy the URL from the browser address bar, and paste it here?"* |

   **Encoding rule:** Spaces in the final URL must be encoded as `%20` (e.g. `Shared%20Documents`, not `Shared Documents`).

5. **Look up the knowledge source schema**:
   ```bash
   node ${CLAUDE_SKILL_DIR}/../../scripts/schema-lookup.bundle.js resolve KnowledgeSourceConfiguration
   ```

6. **Generate the knowledge source YAML**.

   **Public Website:**

   > `PublicSiteSearchSource` uses Bing search to find relevant snippets within the scoped URL. It does **not** crawl or summarize full pages. The URL defines a search scope (not a specific page), and supports a **maximum depth of 2 levels** beyond the domain (e.g. `https://example.com/docs/api` works, `https://example.com/docs/api/v2` is too deep and will be ignored).

   ```yaml
   # Name: <Name>
   # <Description of what this knowledge source provides>
   kind: KnowledgeSourceConfiguration
   source:
     kind: PublicSiteSearchSource
     site: https://www.example.com/docs
   ```

   **SharePoint:**
   ```yaml
   # Name: <Name>
   # <Description of what this knowledge source provides>
   kind: KnowledgeSourceConfiguration
   source:
     kind: SharePointSearchSource
     site: https://contoso.sharepoint.com/sites/MySite/Shared%20Documents/MyFolder
   ```

7. **Always include `# Name:` and a description comment** at the top. These are important for identifying the knowledge source.

8. **Save** to the agent's `knowledge/<descriptive-name>.knowledge.mcs.yml` directory

## Custom API via OnKnowledgeRequested (YAML-only)

When the user wants to connect a **proprietary search API or database** not natively supported by Copilot Studio, use the `OnKnowledgeRequested` trigger. This is a **YAML-only capability with no UI designer** — it intercepts knowledge search requests and lets you call a custom API to populate results.

**How it works:**
1. Create a topic with `OnKnowledgeRequested` trigger
2. Use `System.SearchQuery` (the AI-rewritten query) as input to your API call
3. Transform API results into the required schema: `Content`, `ContentLocation`, `Title`
4. Set `System.SearchResults` with the transformed results

**Use the template:** `${CLAUDE_SKILL_DIR}/../../templates/topics/custom-knowledge-source.topic.mcs.yml`

**Prerequisites:** The user needs a connector action (in `actions/`) that calls their search API. If they don't have one yet, they should create it through the Copilot Studio UI or VS Code extension first.

## Dynamic Knowledge URLs with Global Variables

Knowledge source URLs support `{VariableName}` placeholders — typically global variables — for dynamic routing based on user context. This is powerful for scenarios where different users need different knowledge sources (e.g., geolocation-specific SharePoint folders, region-specific documentation).

**Pattern**: Define a global variable (via `/copilot-studio:add-global-variable`), populate it early in the conversation (e.g., in an OnActivity/conversation-init topic based on user profile or geolocation), then reference it in the knowledge source URL with Power Fx string interpolation.

**SharePoint example** — a workforce agent that routes to different SharePoint folders per region:
```yaml
# Name: Regional HR KB
# This knowledge source provides HR information from the {Global.UserKBURL} SharePoint.
kind: KnowledgeSourceConfiguration
source:
  kind: SharePointSearchSource
  site: =$"{Global.UserKBURL}"
```

**Public website example** — documentation site with region-specific subpaths:
```yaml
# Name: Regional Docs
# Documentation for the user's region at {Global.Region}.
kind: KnowledgeSourceConfiguration
source:
  kind: PublicSiteSearchSource
  site: =$"https://docs.example.com/{Global.Region}/api"
```

**CRITICAL: URL format for the global variable value**. The variable must contain a **direct, clean URL** — not a SharePoint UI URL with query parameters. Copilot Studio cannot resolve AllItems.aspx links.

| Correct (set this in the global variable) | Wrong (will not work) |
|---|---|
| `https://contoso.sharepoint.com/sites/MySite/Shared Documents/MyFolder` | `https://contoso.sharepoint.com/.../AllItems.aspx?id=%2Fsites%2F...&viewid=...` |

Note: spaces are OK in the variable value (unlike static `site:` values which need `%20`), because the Power Fx `$"{Global.UserKBURL}"` expression handles encoding at runtime.

**Implementation checklist** when the user asks for dynamic knowledge:
1. Create the global variable with `/copilot-studio:add-global-variable` (e.g., `UserKBURL`, `Region`)
2. Ensure a topic populates it early in the conversation (e.g., via user profile lookup, geolocation, or asking the user)

From microsoft/skills-for-copilot-studio, MIT.

More from microsoft/skills-for-copilot-studio

Signals

Stars
482
Forks
103
Open issues
29
Last commit (this folder)
May 4, 2026 (5 months ago)
Last release
May 13, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from microsoft

Cite this page

add-knowledge skill. Agent Mart. https://agentmart.dev/skills/microsoft-add-knowledge (last updated 2026-10-24)