npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sitecore-ai-sdk-tools

v0.0.1-alpha.4

Published

[![NPM Version](https://img.shields.io/npm/v/sitecore-ai-sdk-tools)](https://www.npmjs.com/package/sitecore-ai-sdk-tools)

Readme

sitecore-ai-sdk-tools

NPM Version

Vercel AI SDK tools definition for Sitecore Marketplace Application.

APIs and SDKs to used:

Installation

npm install sitecore-ai-sdk-tools

Dependencies

This package requires the following dependencies:

  • @sitecore-marketplace-sdk/client
  • @sitecore-marketplace-sdk/xmc
  • ai - Vercel AI SDK v6
  • zod (comes with Vercel AI SDK)

Agent API Tools

| Integration / Mode | Server-side | Client-side | |---|---|---| | Marketplace Authentication | ⚠️ Custom authorization required (harder to set up) | ✅ OOTB (no config required) | | Vercel AI SDK integration | ✅ OOTB | ⚠️ Custom tool call handling via onFinish or onToolCall callbacks |

Server-side configuration has stricter prerequisites — you need to configure custom authorization in your Marketplace Application — but offers simpler Vercel AI SDK integration. Client-side configuration, on the other hand, requires no additional authentication setup but involves more complex tool call handling via onFinish or onToolCall callbacks.

Server-side

Works for server-side (full-stack) authentication process in Marketplace Application: read more on custom authorization.

Use execution: 'server' when running in a Node.js environment (e.g. Next.js API route or server action), providing a pre-initialized experimental_XMC client:

import { createAgentTools } from "sitecore-ai-sdk-tools";
import { experimental_XMC } from "@sitecore-marketplace-sdk/xmc";
import { generateText } from "ai";

const xmcClient = new experimental_XMC({
  /* your config */
});

const tools = createAgentTools({
  execution: "server",
  client: xmcClient,
  sitecoreContextId: "your-context-id",
});

const result = await generateText({
  model: yourModel,
  prompt: "Get the list of sites",
  tools,
});

Client-side

Works for client-side authentication process in Marketplace Application (default).

Use execution: 'client' in your router.ts file:

import { createAgentTools, executeAgentTool } from "sitecore-ai-sdk-tools";
import { generateText } from "ai";

const tools = createAgentTools({ execution: "client" });

const result = await generateText({
  model: yourModel,
  prompt: "List all sites",
  tools,
});

Vercel AI SDK support client-side tool execution. This is how:

  • define tools in generateText (or similar function), but leave execute function undefined
  • handle tool calls client-side (using useChat and onFinish callback)
// define sitecoreContextId
const executeTool = async (toolPart: ToolUIPart) => {
    const toolName = toolPart.type.substring('tool-'.length);
    if (!sitecoreContextId) {
      throw new Error('No sitecore context found');
    }
    try {
      let res = await executeAgentTool(
        { client, sitecoreContextId },
        { toolName, input: toolPart.input }
      );
      if (!res.success) {
        res = await executePageBuilderTool(
          { client, sitecoreContextId },
          { toolName, input: toolPart.input }
        );
      }
    } catch (error) {
      console.error('Error executing tool:', error);
    }
}

const chat = useChat({
    transport: ...,
    onFinish: async ({ message, finishReason }) => {
    // if tool was finished because of tool call
        if (finishReason !== 'tool-calls') {
            return;
        }
        for (const part of message.parts) {
            if (!part.type.startsWith('tool')) {
                continue;
            }
            const toolPart = part as ToolUIPart;
            if (toolPart.type.startsWith('tool')) {
                // if input is available - run tool
                if (toolPart.state === 'input-available') {
                    await executeTool(toolPart);
                }
            }
        }
    }
});

Page Builder Tools

pageBuilderTools provides tools for navigating and controlling the XM Cloud Page Builder UI. These are only available client-side:

import { pageBuilderTools } from "sitecore-ai-sdk-tools";

const tools = pageBuilderTools();

Available Tools

createAgentTools

Returns all XM Cloud tools grouped by domain:

| Group | Tools | |---|---| | Assets | get_asset_information, search_assets, update_asset, upload_asset | | Pages | get_page, create_page, get_page_template_by_id, get_allowed_components_by_placeholder, get_components_on_page, add_component_on_page, set_component_datasource, add_language_to_page, search_site, get_page_path_by_live_url, get_page_screenshot, get_page_html, get_page_preview_url | | Sites | get_sites_list, get_site_details, get_all_pages_by_site, get_site_id_from_item | | Content | create_content_item, delete_content, get_content_item_by_id, update_content, get_content_item_by_path, list_available_insert_options | | Components | create_component_datasource, search_component_datasources, list_components, get_component | | Personalization | create_personalization_version, get_personalization_versions_by_page, get_condition_templates, get_condition_template_by_id | | Jobs | revert_job, get_job, list_operations | | Environment | list_languages |

pageBuilderTools

Tools for interacting with the XM Cloud Page Builder UI (client-side only):

| Tool | Description | |---|---| | get_current_page_context | Returns info about the currently open page | | get_current_site_context | Returns info about the currently active site | | reload_current_page | Reloads the Page Builder canvas | | navigate_to_another_page | Navigates to a different page by item ID |