detect-mode
Skill486 starsChanged 8 months agoMITView on GitHub
Detect a Copilot Studio agent's authentication mode (DirectLine vs M365) by querying Dataverse. Returns the mode and connection details needed to chat.
In this repository30 other files it gives its agents.
- add-actionSkill
- add-adaptive-cardSkill
- add-generative-answersSkill
- add-global-variableSkill
- add-knowledgeSkill
- add-nodeSkill
- add-other-agentsSkill
- analyze-evalsSkill
- chat-directlineSkill
- chat-sdkSkill
- chat-with-agentSkill
- clone-agentSkill
- create-eval-setSkill
- create-evalSkill
- 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
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Run the detect-only command:
- Very specific: line 21
If the agent is not at the project root, pass --agent-dir <path>.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Detect Agent Authentication Mode
Query the Dataverse bots entity to determine whether the agent uses DirectLine (no auth / manual auth) or the Copilot Studio SDK (integrated auth / Entra ID SSO).
Instructions
Run the detect-only command:
node ${CLAUDE_SKILL_DIR}/../../scripts/chat-with-agent.bundle.js --detect-only $ARGUMENTSIf the agent is not at the project root, pass
--agent-dir <path>.Parse the JSON output from stdout:
DirectLine mode (authenticationmode 1 or 3)
{ "status": "ok", "mode": "directline", "authenticationmode": 1, "tokenEndpoint": "https://...", "schemaName": "..." }The agent uses no authentication or manual authentication. No user credentials needed. The
tokenEndpointis ready to use with/copilot-studio:chat-directline.M365 mode (authenticationmode 2)
{ "status": "ok", "mode": "m365", "authenticationmode": 2, "schemaName": "..." }The agent uses integrated authentication (Entra ID SSO). An App Registration Client ID is needed for
/copilot-studio:chat-sdk.- Return the result to the caller. Do not proceed to chat — that is a separate step.
Error Handling
| Error | Cause | Resolution |
No agent.mcs.yml found | No agent in workspace | Clone the agent first |
No .mcs/conn.json found | Agent not cloned via VS Code extension | Clone with the extension |
Could not detect authentication mode | No cached Dataverse token | Run a push/pull first to cache tokens, or ask the user about their auth config |
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.

