agentleFS
MicrosoftKnown publishermicrosoft/skills-for-copilot-studio/skills/detect-mode/SKILL.md

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.

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
  1. Distinctive:

    Run the detect-only command:

    line 15
  2. Very specific:

    If the agent is not at the project root, pass --agent-dir <path>.

    line 21

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Run the detect-only command:

    node ${CLAUDE_SKILL_DIR}/../../scripts/chat-with-agent.bundle.js --detect-only $ARGUMENTS

    If the agent is not at the project root, pass --agent-dir <path>.

  2. 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 tokenEndpoint is 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.

  3. Return the result to the caller. Do not proceed to chat — that is a separate step.

Error Handling

ErrorCauseResolution
No agent.mcs.yml foundNo agent in workspaceClone the agent first
No .mcs/conn.json foundAgent not cloned via VS Code extensionClone with the extension
Could not detect authentication modeNo cached Dataverse tokenRun a push/pull first to cache tokens, or ask the user about their auth config

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.