Registers, authorizes, and selects AI tools in Orchard Core with CrestApps AI Services. Covers AddCoreAITool, AIToolBuilder, system/hidden/selectable tools, permissions, and MCP exposure.
Ships in crestapps-orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A tool is a named AITool (usually an AIFunction) registered in code. Profiles, templates, chat interactions, and workflow tasks select tools by name; the orchestrator resolves them as keyed services for each request, after an authorization check.
CrestApps.OrchardCore.AI for the tool pickers, permissions, and access evaluator. Install CrestApps packages in the web/startup project.services.AddCoreAITool<TTool>(name); it adds the definition to AIToolDefinitionOptions and a keyed AITool singleton under the same name. Names must be unique and stable..Selectable() to show it in pickers, or .Hidden() to keep it out of pickers while letting a profile (for example a system agent) reference it by name.orchardcore-ai-mcp-server).using System.Text.Json;
using CrestApps.Core.AI;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using OrchardCore.Modules;
namespace MyModule;
public sealed class Startup : StartupBase
{
internal readonly IStringLocalizer S;
public Startup(IStringLocalizer<Startup> stringLocalizer)
{
S = stringLocalizer;
}
public override void ConfigureServices(IServiceCollection services)
{
services.AddCoreAITool<LookupOrderTool>(LookupOrderTool.TheName)
.WithTitle(S["Order lookup"])
.WithDescription(S["Looks up a customer's order status by order number."])
.WithCategory(S["Commerce"])
.Selectable();
}
}
public sealed class LookupOrderTool : AIFunction
{
public const string TheName = "lookupOrder";
private static readonly JsonElement _schema = JsonSerializer.Deserialize<JsonElement>(
"""
{
"type": "object",
"properties": {
"orderNumber": { "type": "string", "description": "The order number." }
},
"required": ["orderNumber"],
"additionalProperties": false
}
""");
public override string Name => TheName;
public override string Description => "Looks up a customer's order status by order number.";
public override JsonElement JsonSchema => _schema;
protected override ValueTask<object> InvokeCoreAsync(AIFunctionArguments arguments, CancellationToken cancellationToken)
{
if (!arguments.TryGetValue("orderNumber", out var value) || value is null)
{
return ValueTask.FromResult<object>("The orderNumber argument is required.");
}
// Resolve scoped services from arguments.Services and check permissions before reading data.
return ValueTask.FromResult<object>($"Order {value} is in transit.");
}
}
The tool is a singleton. Resolve tenant services per call from arguments.Services, never through constructor-injected scoped services.
| Method | Effect |
|---|---|
WithTitle, WithDescription, WithCategory | Picker text and grouping (title and description default to the name) |
WithPurpose | Purpose tag the orchestrator can use to discover tools (see AIToolPurposes) |
WithDependency, WithDependencies | Tools automatically included when this tool is selected |
WithoutDependency, WithoutDependencies | Remove a dependency |
Selectable() | Not a system tool, shown in pickers |
Hidden() | Not a system tool, not shown in pickers, still selectable by name |
RequireApproval() | The chat UI and admin widget ask the user to Allow or Deny each call before it runs (AG-UI interrupt); chats that cannot ask (SMS, voice) run it as before. See orchardcore-ai-chat |
services.MarkAIToolAnonymousSafe(name) (CrestApps.OrchardCore.AI.Core.Extensions) marks a tool anyone may run, so WebMCP can offer it to visitors who are not signed in (see orchardcore-ai-webmcp). Mark only tools that read public data or act on the caller's own data.
AIToolDefinitionOptions.GetSelectableTools() returns the tools that are neither system nor hidden.
For every completion, the orchestrator asks its registry providers for tools:
ProfileToolRegistryProvider returns the tool names configured on the completion context, skipping system tools.SystemToolRegistryProvider adds the system tools.orchardcore-ai-tool-instances), agents (orchardcore-ai-agent), MCP connections, and A2A connections contribute their own entries.IAIToolAccessEvaluator; Orchard Core registers OrchardCoreAIToolAccessEvaluator, which authorizes AccessAITool with the tool name as the resource.When the checks run:
| Moment | Check |
|---|---|
| Editing a profile, template, interaction, workflow task, or the MCP Server card | Pickers list only the selectable tools the editing user may access. |
| Sending a chat interaction message | Each selectable tool on the interaction is re-checked for the caller. Denied tools are removed from the request, not failed, and a Warning log entry lists them. |
| Running an AI profile session | The profile is the authorization boundary: it runs exactly as configured (it may be anonymous), with no per-user tool check at send time. Control who may use it with the profile query permissions. |
| System and hidden (dependency) tools | Never checked. |
A hidden tool reaches a session only when the session names it: through a profile or agent selection, a
dependency, or the completion context's AICompletionContext.ToolNames (plus OrchestrationContext.MustIncludeTools
to keep the selection from dropping it). The call and hand-off tools of automated conversations (End the
call, Press keys, Collect digits securely, Transfer to live agent) are registered hidden for this
reason: as system tools they reached every chat on the site. Register channel-only tools the same way.
| Surface | Editor | Storage |
|---|---|---|
| AI Profile | Capabilities tab, Tools | FunctionInvocationMetadata.Names (the legacy AIProfileFunctionInvocationMetadata is read and removed on save) |
| AI Profile Template (Profile source) | Capabilities tab | ProfileTemplateMetadata.ToolNames |
| Chat Interaction | Capabilities tab | ChatInteraction.ToolNames |
| AI Completion using Direct Config task | Capabilities tab | ToolNames of the task's embedded ChatInteraction |
| Post-session processing | Data processing & metrics tab, Post-session processing card | Stored apart from the live selection |
Pickers list only the selectable tools the editing user may access, grouped by category, and saving keeps only names the user may access.
| Permission | Meaning |
|---|---|
AccessAnyAITool | Use every tool. Security critical; granted to Administrator by default. |
AccessAITool | Base permission checked with the tool name as resource; implied by the two others. |
AccessAITool_{toolName} | Use one tool. Generated for every registered tool and every tool instance function. |
Who may configure a tool and who may run it are different questions. Editors need the tool permission to select it. Chat interaction users need it at send time. AI profile sessions rely on the profile query permissions (QueryAnyAIProfile or QueryAIProfile_{profileName}), so only attach privileged tools to profiles whose query permission is equally restricted.
The caller comes from the framework's IUserAccessor, not IHttpContextAccessor. The AI chat hubs publish the connection principal for each invocation, so checks over SignalR match checks over HTTP.
Anonymous role is granted applies.| Feature | Tools |
|---|---|
CrestApps.OrchardCore.AI.Agent | Content, content definition, feature, tenant, recipe, user, role, workflow, communication, AI profile, AI conversation (listAIConversations, viewAIConversation, getAIContactMemory), AI quality (summarizeAIQuality, listAITestCases, runAITests, listAIAlerts, with AI Quality) and analytics tools. See orchardcore-ai-agent. |
CrestApps.OrchardCore.NLWeb (with AI) | ask: asks the site a question and returns matching content items as schema.org objects. Runs as the caller with QueryNLWeb and returns only published items the caller may view |
CrestApps.OrchardCore.Seo (with AI) | getSchemaOrgOptions, configureContentTypeSchemaOrg, configureSiteStructuredData for schema.org structured data |
CrestApps.OrchardCore.AI.WebMcp | Tools a browser page registers on document.modelContext, run through the AI chat for profiles with Allow page tools. See orchardcore-ai-webmcp |
CrestApps.OrchardCore.AI.Memory | Search, list, save, and remove user memories (authenticated users with memory enabled). See orchardcore-ai-memory. |
CrestApps.OrchardCore.AI.A2A | listAvailableAgents, findAgentForTask, findToolsForTask. See orchardcore-ai-a2a-client. |
| AI Documents features | Document, tabular, PowerPoint, Word, and PDF tools and system agents. See orchardcore-ai-documents. |
CrestApps.OrchardCore.Tickets (with AI) | listTicketOptions, searchTickets, getTicket, createTicket, addTicketReply, updateTicket (category Tickets; act for the signed-in person within their ticket permissions). See orchardcore-tickets. |
CrestApps.OrchardCore.AgenticCommerce (with AI, Products Listing and Product Feeds) | searchStoreProducts, getStoreProduct, addToStoreCart, getStoreCart, startStoreCheckout (category Commerce; marked safe for anyone, never pays). See orchardcore-agentic-commerce. |
CrestApps.OrchardCore.Learning.AI (Learning Assistant) | getMyLearningProgress, getMyNextLesson, explainMyQuizResult (with Learning Assessments), listOverdueLearners, listLearnersExpiringSoon. See orchardcore-learning. |
Functions an administrator creates from a tool instance source are tenant data, not code registrations; see orchardcore-ai-tool-instances. The Workflow source turns a workflow that starts with AI Tool Called into a tool (see orchardcore-ai-conversations).
| Symptom | Check |
|---|---|
| A registered tool is not in the picker | It is a system tool. Add .Selectable(). |
| A chat interaction tool works for admins but not for a role | Grant AccessAITool_{toolName} (or AccessAnyAITool) and look for the Warning that lists excluded tools. |
| An editor cannot see a tool in the picker | The editing user lacks AccessAITool_{toolName}. |
| A tool is missing for MCP clients | Only selectable tools can be exposed, and they must be opted in on the MCP Server card. |
| A channel-only tool shows up in every chat | It is registered as a system tool. Register it .Hidden() and name it in AICompletionContext.ToolNames where it applies. |
| A tool resolves stale tenant data | Do not inject scoped services into the singleton tool; resolve them from arguments.Services. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, ai-tools, tool-registration, authorization, mcp
/crestapps-orchardcore:orchardcore-ai-toolsfrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts.Other plugins' skills for the same job