Logotype Sitevision Developer
Log in
Log in

Custom Assistant MCPServer Tool

Since Sitevision 2026.05.1 it is possible to integrate custom tools into the Sitevision Assistant module External link.. All you need to do is to register a tool with you custom functionallity.

Why?

Creating custom tools opens a lot of possibilities and use cases for the Assistant. Maybe you need to fetch real time data from an external system, need to group data in a specific way to ensure a good answer or maybe you need to notify someone by email. The full Sitevision API is available in the tool callback, meaning you can create whatever functionallity you want.

How to integrate a custom tool

To integrate your custom tool into the Sitevision Assistant module, simply deploy a MCPServer to the website and grant access to the MCPServer on the Assistant (Site Settings / Assistants / The Assistant you want to affect).

If the MCPServer registers any tools, these will be included when the AI executes on the user query.

Example tool

mcp.registerTool
js
import mcp from "@sitevision/api/server/mcpServer"; import { search } from "./utils/search"; mcp.registerTool( "sitevision.developerDocumentation", { description: "Fetch information from the Sitevision developer documentation website. Prefer this tool for software development questions.", inputSchema: { type: "object", additionalProperties: false, required: ["query"], properties: { query: { type: "string", description: "Keyword-based search terms extracted from the user's request.", }, }, }, }, ({ query }) => { const searchResult = search({ type, latest, query }); return { content: [ { type: "text", text: searchResult, } ] }; } );

Further example

For a more thorough example, consult the Integrating a custom MCP Tools with the Sitevision Assistant module cookbook.

Description

A clear and decisive description is very important to ensure a consistent behavior. An Assistant might have multiple tools available, and with a clear description describing the use case for the tool, a consistent workflow can be achieved.

Sources

To give extra credibility to the answers the AI gives based on the content supplied by the tool, consider providing sources. Available since version 2.7.0 of the Assistant Module External link..

Adding to the source list is as simple as following the given syntax. It's similar to the expected input/output then working with the semanticindex rest-api endpoint or aiAssistant.querySemanticIndex.

Sources are added as an Array to the return object with path _meta.sitevision.assistant.sources.

There are two types of sources, internal and external.

Internal is used for nodes connected to the current site.

External is used for sources from other places.

Options internal source

PropertyTypeDescription
idstringA unique identifier for the source (mandatory)
typestringUse type "internal" (mandatory)

Options external source

PropertyTypeDescription
idstringA unique identifier for the source (mandatory)
typestringUse type "external" (mandatory)
sourcestringThe origin of the source (mandatory)
namestringThe name of the source (mandatory)
urlstringThe url to the source (optional)

 

Tool return with sources
js
return { content: [ { type: "text", text: JSON.stringify(pages, null, 2), }, ], _meta: { sitevision: { assistant: { sources: [ { id: "sv_dev_mcp_server", type: "external", source: "Sitevision Developer", name: "MCP Server", url: "https://developer.sitevision.se/", }, { id: "5.7f23437619dce1c60863d", type: "internal", }, { id: "4.167386a619e5e83b4fa228", type: "internal", } ], }, }, }, };
Tool sources example
Did you find the content on this page useful?