agentleFS
MicrosoftKnown publishermicrosoft/rayfin/samples/universal-app/template/.agents/skills/fabric-data-agent/SKILL.md

fabric-data-agent

Skill646 starsChanged 38 days agoMITView on GitHub

Call a published Fabric data agent from a Universal App through a Rayfin function using application auth and MCP streamable HTTP. Use when the request names a Fabric data agent, data-agent MCP endpoint, or asks to chat with governed Fabric data through an app.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 6 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use a Rayfin function so the Fabric access token remains server-side.

    line 12
  2. Very specific:

    Read functions-capability and apply its pack before implementing this workflow.

    line 13
  3. Distinctive:

    Do not substitute the legacy OpenAI-style endpoint.

    line 19
  4. Very specific:

    Use ctx.Tokens.Fabric, not an API key or service-principal secret.

    line 26
  5. Distinctive:

    Import the Fabric audience and context from the functions runtime:

    line 30
  6. Distinctive:

    Never return it to the browser or write it to application logs.

    line 62
  7. Very specific:

    Treat Mcp-Session-Id as optional.

    line 75
  8. Distinctive:

    Do not log questions, answers, bearer tokens, provider bodies, or sensitive exceptions.

    line 91
  9. Distinctive:

    Do not make an extended timeout the default for every app operation.

    line 104
  10. Distinctive:

    If needed, isolate the workaround to a dedicated data-agent client and document that the full platform execution duration remains to be …

    line 105
  11. Very specific:

    Do not return from the UDF and expect work to continue in the background.

    line 108

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

Fabric data agent

Use a Rayfin function so the Fabric access token remains server-side. Read functions-capability and apply its pack before implementing this workflow.

Required input

Obtain the published data-agent MCP endpoint. Do not substitute the legacy OpenAI-style endpoint. The published endpoint has this shape:

https://api.fabric.microsoft.com/v1/mcp/workspaces/{workspaceId}/dataagents/{dataAgentId}/agent

Use ctx.Tokens.Fabric, not an API key or service-principal secret.

Fabric access token

Import the Fabric audience and context from the functions runtime:

import {
  AudienceType,
  UserDataFunctions,
  type RayfinContext,
} from '@microsoft/fabric-user-data-functions';

const udf = new UserDataFunctions();

udf.func(
  'askFabricDataAgent',
  async (
    ctx: RayfinContext<AppSchema, AudienceType.Fabric>,
    question: string
  ): Promise<DataAgentResult> => {
    const token: string = ctx.Tokens.Fabric;
    // Perform the MCP exchange and return only the bounded result.
  },
  [] // the audience in the annotation is the declaration
);

The audience union on the context annotation is what registers the connection — declare it there, written literally as AudienceType.Fabric, and read the token as ctx.Tokens.Fabric. Requesting an audience the annotation does not declare is a compile error. ctx.getToken(...) is deprecated and flagged by @typescript-eslint/no-deprecated.

Send the token only in the server-side Authorization: Bearer <token> header. Never return it to the browser or write it to application logs. The deployed function accesses the data agent using the app identity's permissions.

MCP exchange

The function performs this sequence:

  1. Send initialize.
  2. Send notifications/initialized.
  3. Call tools/list.
  4. Discover the advertised tool and its question argument.
  5. Call tools/call.

Treat Mcp-Session-Id as optional. Forward it when supplied, but do not fail initialization when it is absent.

Parse successful bodies according to their content type. Support JSON and server-sent events for JSON-RPC responses. Accept a non-JSON acknowledgement such as plain-text Accepted without trying to parse it as JSON.

Use references/mcp-streamable-http.md as the reusable transport reference. Copy and adapt the helper into the functions source only for a data-agent scenario. The general functions pack deliberately does not seed MCP code into every app.

Bound the question and the answer returned to the browser. Do not log questions, answers, bearer tokens, provider bodies, or sensitive exceptions.

Long-running behavior

The function's outbound MCP deadline and the browser's wait for the function invocation are independent. Both must accommodate the operation.

Show a visible progress state explaining that a data-agent response may take up to 10 minutes. The current frontend SDK has a client-wide timeout rather than a per-invocation timeout. Do not make an extended timeout the default for every app operation. If needed, isolate the workaround to a dedicated data-agent client and document that the full platform execution duration remains to be verified.

Do not return from the UDF and expect work to continue in the background. The current MCP tools/call is one awaited request. A start-and-poll design requires a durable operation ID from the downstream service or an app-owned queue, worker, and result store.

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.