/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 26f3d73cbf31
 */
// Optional function to assist with formatting prompt results
export async function formatResult(value) {
    return {
        messages: [
            {
                role: "user",
                content: {
                    type: "text",
                    text: value,
                },
            },
        ],
    };
}
export function createRegisterPrompt(logger, server, getSDK, allowedScopes) {
    return (prompt) => {
        const scopes = prompt.scopes ?? [];
        if (allowedScopes.size > 0 && scopes.length === 0) {
            return;
        }
        if (allowedScopes.size > 0
            && !scopes.every((s) => allowedScopes.has(s))) {
            return;
        }
        if (prompt.args) {
            if (prompt.description) {
                server.prompt(prompt.name, prompt.description, prompt.args, async (args, ctx) => prompt.prompt(getSDK(), args, ctx));
            }
            else {
                server.prompt(prompt.name, prompt.args, async (args, ctx) => prompt.prompt(getSDK(), args, ctx));
            }
        }
        else {
            if (prompt.description) {
                server.prompt(prompt.name, prompt.description, async (ctx) => prompt.prompt(getSDK(), ctx));
            }
            else {
                server.prompt(prompt.name, async (ctx) => prompt.prompt(getSDK(), ctx));
            }
        }
        logger.debug("Registered prompt", { name: prompt.name });
    };
}
//# sourceMappingURL=prompts.js.map