Skip to content

Guided tour

FabrCore 2.0 · Release and package availability

These guides track the current 2.0 source. Stable 2.0.0 publication is pending; package commands show the release target. Until it is published, follow the source quick start or use a matching available prerelease set. Release migration · Runtime modes

MODULE 10 · LESSON 10.5

Build Graph-backed plugins

Replace fixture lookups with narrowly scoped Microsoft Graph plugins.

Lesson 57 of 86 · FabrCore 2.0

Overview

A Graph plugin is application code using a protected connection; FabrCore does not automatically ship every mail/calendar/SharePoint operation. GetHttpClientAsync keeps token acquisition out of the model interface. Separate read, draft and send/write operations.

Resolve the client inside trusted code

GetHttpClientAsync obtains a client through the configured connection/resource. The model supplies a business request such as a date range, while the plugin supplies the authorized connection context. This keeps token acquisition and audience selection out of the model's argument list. Validate the actual Graph operation and handle response errors in the plugin.

Separate reads from writes

Reading a calendar, drafting a change and sending an invitation are different business operations. Give them separate tool contracts and authorization/review behavior. Return only the fields needed for the assistant's task, and do not include tokens or full provider error dumps in model context. The broker does not supply every possible Graph business tool for you.

Call Graph from a narrow plugin

  1. Resolve the graph resource with Connections.GetHttpClientAsync in trusted agent/plugin code. Start with a permitted profile or calendar read.
  2. Add bounded calendar availability, mail-draft or SharePoint/OneDrive document retrieval functions with operation-specific permissions. Use raw tokens only for trusted SDKs that require them.
  3. For writes, validate owner, inputs and explicit application approval, then verify the external result. Feed retrieved policy files into the established knowledge ingestion path.
Agent SDK usage and MCP · reference snippet
using var graph = await Connections.GetHttpClientAsync("mail", "graph", ct);
var messages = await graph.GetStringAsync(
    "users/" + Uri.EscapeDataString(mailbox) + "/messages?$top=10", ct);

// Only when a trusted SDK requires the raw token:
var token = await Connections.GetAccessTokenAsync("mail", "graph", ct);
await trustedSdk.CallAsync(token.AccessToken, ct);

Compare the tool result with the test resource

  1. Using a consented test account, implement one read-only Graph operation and request a known test record or bounded date range. Inspect the plugin result and compare it with the resource's actual data.
  2. Ask the assistant to summarize that returned information. Confirm the tool invocation used the intended profile/resource and that the answer did not claim an unrelated write occurred.
  3. Remove the relevant consent or allowed-handle permission and repeat. Expect a recoverable authorization/connection error, not fallback access under an administrator's identity.

This proves the plugin uses the protected connection for a specific operation. It does not establish permission for every Graph endpoint.

If the result is different

A delegated permission and an application permission are not interchangeable. Verify required scopes/admin consent for each actual Graph endpoint in the current Microsoft documentation.

Go deeper

Explore the related documentation.