add-knowledge
Skill486 starsChanged 8 months agoMITView on GitHub
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.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- microsoft/copilot-studio-plugintheir own version, first seen Sep 25, 2026
- thunderphone/skillstheir own version, first seen Sep 16, 2026
- tikhomirovv/agents-knowledgetheir own version, first seen Aug 1, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- microsoft/copilot-studio-plugin★ 82same name
- tikhomirovv/agents-knowledge★ 2same name
- thunderphone/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository30 other files it gives its agents.
- add-actionSkill
- add-adaptive-cardSkill
- add-generative-answersSkill
- add-global-variableSkill
- add-nodeSkill
- add-other-agentsSkill
- analyze-evalsSkill
- chat-directlineSkill
- chat-sdkSkill
- chat-with-agentSkill
- clone-agentSkill
- create-eval-setSkill
- create-evalSkill
- detect-modeSkill
- directline-chatSkill
- edit-actionSkill
- edit-agentSkill
- edit-triggersSkill
- int-patternsSkill
- int-project-contextSkill
- int-referenceSkill
- list-kindsSkill
- list-topicsSkill
- lookup-schemaSkill
- manage-agentSkill
- new-topicSkill
- run-evalSkill
- run-tests-kitSkill
- test-authSkill
- validateSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 4 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Add a knowledge source to the agent.
- Distinctive: line 20
NEVER hardcode an agent name.
- Very specific: line 27
If the URL contains sharepoint.com → use SharePointSearchSource (but first normalize the URL — see below)
- Very specific: line 28
If the user wants to connect a custom search API or database → use OnKnowledgeRequested (see Custom API section below)
- Very specific: line 31
If SharePoint: normalize the URL: before using it. Copilot Studio requires a direct folder path like: …
- Very specific: line 83
Create a topic with OnKnowledgeRequested trigger
- Very specific: line 84
Use System.SearchQuery (the AI-rewritten query) as input to your API call
- Distinctive: line 126
Implementation checklist: when the user asks for dynamic knowledge:
- Very specific: line 127
Create the global variable with /copilot-studio:add-global-variable (e.g., UserKBURL, Region)
- Distinctive: line 128
Ensure a topic populates it early in the conversation (e.g., via user profile lookup, geolocation, or asking the user)
- Very specific: line 129
Create the knowledge source with =$"{Global.VariableName}" syntax in the site: field
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add Knowledge Source
Add a knowledge source to the agent. Supports Public Website, SharePoint, and Custom API sources.
Instructions
- Auto-discover the agent directory:
NEVER hardcode an agent name.Glob: **/agent.mcs.yml - Parse the arguments to extract:
- URL
- Name / description (optional)
- Determine the source type from the user's request:
- If the URL contains
sharepoint.com→ useSharePointSearchSource(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
- If the URL contains
If SharePoint: normalize the URL before using it. Copilot Studio requires a direct folder path like:
https://contoso.sharepoint.com/sites/MySite/Shared%20Documents/MyFolderUsers 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/FolderUse 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 idquery 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=abcCannot 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, notShared Documents).- Look up the knowledge source schema:
node ${CLAUDE_SKILL_DIR}/../../scripts/schema-lookup.bundle.js resolve KnowledgeSourceConfiguration Generate the knowledge source YAML.
Public Website:
PublicSiteSearchSourceuses 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/apiworks,https://example.com/docs/api/v2is too deep and will be ignored).# Name: <Name> # <Description of what this knowledge source provides> kind: KnowledgeSourceConfiguration source: kind: PublicSiteSearchSource site: https://www.example.com/docsSharePoint:
# Name: <Name> # <Description of what this knowledge source provides> kind: KnowledgeSourceConfiguration source: kind: SharePointSearchSource site: https://contoso.sharepoint.com/sites/MySite/Shared%20Documents/MyFolder- Always include
# Name:and a description comment at the top. These are important for identifying the knowledge source. - Save to the agent's
knowledge/<descriptive-name>.knowledge.mcs.ymldirectory
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:
- Create a topic with
OnKnowledgeRequestedtrigger - Use
System.SearchQuery(the AI-rewritten query) as input to your API call - Transform API results into the required schema:
Content,ContentLocation,Title - Set
System.SearchResultswith 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:
# 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:
# 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:
- Create the global variable with
/copilot-studio:add-global-variable(e.g.,UserKBURL,Region) - Ensure a topic populates it early in the conversation (e.g., via user profile lookup, geolocation, or asking the user)
- Create the knowledge source with
=$"{Global.VariableName}"syntax in thesite:field - Remind the user: the variable must be set before any topic that triggers knowledge search, otherwise the URL will be blank
Knowledge Architecture & Best Practices
For detailed guidance on how knowledge retrieval works, source selection, content quality, security, maintenance, and advanced patterns like triggerCondition, see knowledge-guide.md.
Limitations
This skill can create Public Website and SharePoint knowledge sources.
For other types, inform the user:
"The following knowledge source types must be created through the Copilot Studio UI as they require Power Platform configuration:
- Dataverse tables
- Uploaded files
- AI Search
- SQL Server
Please create these in the portal, then clone the solution to edit them here."
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

