@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
20 lines • 818 B
JavaScript
/** Resolves one imported tool's kind. Anything other than an explicit widening stays `action`. */
export function resolveMcpToolKind(tool, policy) {
if (typeof policy === 'function') {
return policy(tool);
}
if (policy === 'read') {
return 'read';
}
if (policy === 'trust-annotations') {
// `destructiveHint` is only meaningful when `readOnlyHint` is false, so a tool claiming both is
// describing itself incoherently — resolved on the gated side rather than guessing which half
// of the claim to believe.
const annotations = tool.annotations;
return annotations?.readOnlyHint === true && annotations.destructiveHint !== true
? 'read'
: 'action';
}
return 'action';
}
//# sourceMappingURL=tool-kind.js.map