@typeroll/mcp-server 0.45.158 → 0.45.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/api-url.d.ts +7 -0
- package/dist/bundled-content.d.ts +3 -0
- package/dist/bundled-content.js +3 -3
- package/dist/client.d.ts +45 -0
- package/dist/client.js +16 -1
- package/dist/compact-tools.d.ts +13 -0
- package/dist/extension-cli.d.ts +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/init.d.ts +18 -0
- package/dist/install-skills.d.ts +25 -0
- package/dist/public-http.d.ts +2 -0
- package/dist/resolve-site-id.d.ts +7 -0
- package/dist/rest-reference.d.ts +35 -0
- package/dist/server.d.ts +70 -0
- package/dist/structured-data.d.ts +124 -0
- package/dist/tools/access.d.ts +2 -0
- package/dist/tools/access.js +2 -2
- package/dist/tools/apps.d.ts +2 -0
- package/dist/tools/block-types.d.ts +2 -0
- package/dist/tools/bulk.d.ts +2 -0
- package/dist/tools/bulk.js +1 -1
- package/dist/tools/clipboard.d.ts +2 -0
- package/dist/tools/collection.d.ts +2 -0
- package/dist/tools/collection.js +1 -1
- package/dist/tools/content-types.d.ts +2 -0
- package/dist/tools/deploy.d.ts +2 -0
- package/dist/tools/deploy.js +3 -2
- package/dist/tools/domain.d.ts +2 -0
- package/dist/tools/domain.js +13 -5
- package/dist/tools/email.d.ts +2 -0
- package/dist/tools/extensions.d.ts +6 -0
- package/dist/tools/fonts.d.ts +2 -0
- package/dist/tools/forms.d.ts +2 -0
- package/dist/tools/forms.js +1 -1
- package/dist/tools/helpers.d.ts +48 -0
- package/dist/tools/media.d.ts +2 -0
- package/dist/tools/media.js +1 -1
- package/dist/tools/menus.d.ts +2 -0
- package/dist/tools/migration.d.ts +2 -0
- package/dist/tools/owner-review.d.ts +2 -0
- package/dist/tools/packages.d.ts +2 -0
- package/dist/tools/packages.js +1 -1
- package/dist/tools/page-blocks.d.ts +2 -0
- package/dist/tools/page-templates.d.ts +2 -0
- package/dist/tools/pages.d.ts +2 -0
- package/dist/tools/partials.d.ts +2 -0
- package/dist/tools/preview.d.ts +2 -0
- package/dist/tools/readiness.d.ts +2 -0
- package/dist/tools/redirects.d.ts +2 -0
- package/dist/tools/reusable-blocks.d.ts +2 -0
- package/dist/tools/search.d.ts +2 -0
- package/dist/tools/search.js +1 -1
- package/dist/tools/settings.d.ts +2 -0
- package/dist/tools/site-fields.d.ts +2 -0
- package/dist/tools/sites.d.ts +10 -0
- package/dist/tools/sites.js +2 -3
- package/dist/tools/skills.d.ts +31 -0
- package/dist/tools/snippets.d.ts +2 -0
- package/dist/tools/structured-data.d.ts +2 -0
- package/dist/tools/styles.d.ts +2 -0
- package/dist/tools/versions.d.ts +2 -0
- package/dist/tools/workflows.d.ts +2 -0
- package/dist/tools/working-copy.d.ts +2 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -1
- package/dist/workspace.d.ts +47 -0
- package/package.json +29 -8
- package/skills/tr-forms.md +5 -0
- package/skills/tr-images.md +5 -6
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface ClientConfig {
|
|
2
|
+
/** Base URL of the Typeroll portal, e.g. https://app.typeroll.com */
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
/** typeroll_live_... bearer token */
|
|
5
|
+
apiKey: string;
|
|
6
|
+
defaultVersion?: string;
|
|
7
|
+
organizationId?: string;
|
|
8
|
+
selectedSiteId?: string;
|
|
9
|
+
lockVersion?: boolean;
|
|
10
|
+
/** Override fetch (for tests). Defaults to global fetch. */
|
|
11
|
+
fetchImpl?: typeof fetch;
|
|
12
|
+
}
|
|
13
|
+
export declare class ApiError extends Error {
|
|
14
|
+
readonly status: number;
|
|
15
|
+
readonly body: unknown;
|
|
16
|
+
constructor(status: number, body: unknown, message?: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class TyperollClient {
|
|
19
|
+
private readonly config;
|
|
20
|
+
private readonly defaultVersion?;
|
|
21
|
+
private readonly baseUrl;
|
|
22
|
+
private readonly apiKey;
|
|
23
|
+
private readonly fetchImpl;
|
|
24
|
+
constructor(config: ClientConfig);
|
|
25
|
+
/** Clone per call, so simultaneous chats never share mutable site selection. */
|
|
26
|
+
forOrganization(organizationId: string, siteId?: string, version?: string): TyperollClient;
|
|
27
|
+
/** Build the full URL for a path (relative to /api/v1/sites/{siteId}/...) */
|
|
28
|
+
private url;
|
|
29
|
+
/** Top-level URL (no siteId prefix) — /v1/sites, /v1/organization/*, /v1/publishing/*. */
|
|
30
|
+
private rootUrl;
|
|
31
|
+
private request;
|
|
32
|
+
get<T>(siteId: string, path: string, query?: Record<string, string | number | undefined>): Promise<T>;
|
|
33
|
+
post<T>(siteId: string, path: string, body?: unknown, query?: Record<string, string | number | undefined>): Promise<T>;
|
|
34
|
+
patch<T>(siteId: string, path: string, body?: unknown, query?: Record<string, string | number | undefined>): Promise<T>;
|
|
35
|
+
put<T>(siteId: string, path: string, body?: unknown, query?: Record<string, string | number | undefined>): Promise<T>;
|
|
36
|
+
del<T>(siteId: string, path: string, query?: Record<string, string | number | undefined>, body?: unknown): Promise<T>;
|
|
37
|
+
rootGet<T>(path: string): Promise<T>;
|
|
38
|
+
rootPost<T>(path: string, body?: unknown): Promise<T>;
|
|
39
|
+
rootPut<T>(path: string, body?: unknown): Promise<T>;
|
|
40
|
+
rootPatch<T>(path: string, body?: unknown): Promise<T>;
|
|
41
|
+
/** `/api/developer/{path}` — the Extension developer API used by the
|
|
42
|
+
* `typeroll extension` CLI. Requires an organization-scoped key. */
|
|
43
|
+
developer<T>(method: 'GET' | 'POST' | 'PATCH', path: string, body?: unknown, query?: Record<string, string | number | undefined>): Promise<T>;
|
|
44
|
+
rootDelete<T>(path: string, body?: unknown): Promise<T>;
|
|
45
|
+
}
|
package/dist/client.js
CHANGED
|
@@ -15,6 +15,17 @@ export class ApiError extends Error {
|
|
|
15
15
|
this.name = 'ApiError';
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Refuse `.` and `..` path segments, including percent-encoded ones: URL
|
|
20
|
+
* parsing resolves them, so an ID made of dots would address another route.
|
|
21
|
+
*/
|
|
22
|
+
function assertNoDotSegments(path) {
|
|
23
|
+
const pathname = path.split(/[?#]/, 1)[0] ?? '';
|
|
24
|
+
for (const segment of pathname.split(/[\\/]/)) {
|
|
25
|
+
if (/^(?:\.|%2e){1,2}$/i.test(segment))
|
|
26
|
+
throw new Error('Invalid ID: "." and ".." are not allowed in a path.');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
18
29
|
export class TyperollClient {
|
|
19
30
|
config;
|
|
20
31
|
defaultVersion;
|
|
@@ -42,6 +53,7 @@ export class TyperollClient {
|
|
|
42
53
|
if (this.config.selectedSiteId && siteId !== this.config.selectedSiteId)
|
|
43
54
|
throw new Error('Select the other site before accessing it.');
|
|
44
55
|
const cleanPath = path.replace(/^\/+/, '');
|
|
56
|
+
assertNoDotSegments(`${encodeURIComponent(siteId)}/${cleanPath}`);
|
|
45
57
|
const url = new URL(`${this.baseUrl}/api/v1/sites/${encodeURIComponent(siteId)}/${cleanPath}`);
|
|
46
58
|
const versionKey = /^blocks\/export\/?$/.test(cleanPath) ? 'version_branch' : 'version';
|
|
47
59
|
if (this.defaultVersion)
|
|
@@ -60,6 +72,7 @@ export class TyperollClient {
|
|
|
60
72
|
/** Top-level URL (no siteId prefix) — /v1/sites, /v1/organization/*, /v1/publishing/*. */
|
|
61
73
|
rootUrl(path, query) {
|
|
62
74
|
const cleanPath = path.replace(/^\/+/, '');
|
|
75
|
+
assertNoDotSegments(cleanPath);
|
|
63
76
|
const url = new URL(`${this.baseUrl}/api/v1/${cleanPath}`);
|
|
64
77
|
if (query) {
|
|
65
78
|
for (const [k, v] of Object.entries(query)) {
|
|
@@ -132,7 +145,9 @@ export class TyperollClient {
|
|
|
132
145
|
/** `/api/developer/{path}` — the Extension developer API used by the
|
|
133
146
|
* `typeroll extension` CLI. Requires an organization-scoped key. */
|
|
134
147
|
developer(method, path, body, query) {
|
|
135
|
-
const
|
|
148
|
+
const cleanPath = path.replace(/^\/+/, '');
|
|
149
|
+
assertNoDotSegments(cleanPath);
|
|
150
|
+
const url = new URL(`${this.baseUrl}/api/developer/${cleanPath}`);
|
|
136
151
|
for (const [k, v] of Object.entries(query ?? {})) {
|
|
137
152
|
if (v !== undefined && v !== null)
|
|
138
153
|
url.searchParams.set(k, String(v));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ZodRawShape } from 'zod';
|
|
2
|
+
import { type ToolResult } from './tools/helpers.js';
|
|
3
|
+
export type ToolEffect = 'read' | 'write' | 'admin';
|
|
4
|
+
export interface CallableTool {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
schema: ZodRawShape;
|
|
8
|
+
effect: ToolEffect;
|
|
9
|
+
invoke: (args: Record<string, unknown>) => Promise<ToolResult>;
|
|
10
|
+
}
|
|
11
|
+
export declare const COMPACT_INSTRUCTIONS = "Typeroll CMS. Use search_tools to find a task's tools, describe_tool to read one exact schema, then call_read_tool, call_write_tool or call_admin_tool. Discover before you write: identify Site/Version, capabilities and enabled app documentation. Read only the relevant skill or guide section; do not load the full manual by default. Larger changes: create_branch and keep the same version. Working copy, saved content and live output differ. Publishing and other external effects require the user's authorization; tool access alone is not approval. After cutover a deploy reaches the live domain: it needs the owner's approval and confirm_live_domains: true.";
|
|
12
|
+
/** Stable discovery surface: no dynamic registration or client list-change support needed. */
|
|
13
|
+
export declare function compactTools(catalog: CallableTool[]): CallableTool[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type Json = Record<string, unknown>;
|
|
2
|
+
export declare function validateExtensionManifestShape(manifest: Json): string[];
|
|
3
|
+
export declare function extensionMetadataUpdate(manifest: Json, registered: Json, manifestOrigins: string[]): Json;
|
|
4
|
+
export interface InstallSite {
|
|
5
|
+
/** The site id within its organization, as used in /api/v1/sites/{siteId}. */
|
|
6
|
+
siteId: string;
|
|
7
|
+
/** The owning organization when given as `org/site`, otherwise null. */
|
|
8
|
+
ownerOrgId: string | null;
|
|
9
|
+
/** The entry written to a private Extension's allowed_site_ids. */
|
|
10
|
+
allowEntry: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse `install --site`. `org/site` names a site of any organization and is
|
|
14
|
+
* written to allowed_site_ids in that form; a bare site id only ever matches
|
|
15
|
+
* a site of the developer organization itself.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseInstallSite(value: string): InstallSite;
|
|
18
|
+
export declare function runExtensionCli(args: string[]): Promise<number>;
|
|
19
|
+
export {};
|
package/dist/index.d.ts
ADDED
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface InitOptions {
|
|
2
|
+
dir: string;
|
|
3
|
+
update?: boolean;
|
|
4
|
+
recipes?: boolean;
|
|
5
|
+
client?: 'none' | 'claude' | 'cursor' | 'vscode';
|
|
6
|
+
sourceDir?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function runInit(options: InitOptions): Promise<{
|
|
9
|
+
dir: string;
|
|
10
|
+
generator_version: string;
|
|
11
|
+
files: {
|
|
12
|
+
path: string;
|
|
13
|
+
action: "created" | "updated" | "kept" | "modified";
|
|
14
|
+
}[];
|
|
15
|
+
client: "none" | "claude" | "cursor" | "vscode";
|
|
16
|
+
recipes: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function runInitCli(args: string[]): Promise<number>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare function skillsDir(): string;
|
|
2
|
+
export interface InstallSkillsResult {
|
|
3
|
+
destination: string;
|
|
4
|
+
copied: string[];
|
|
5
|
+
skipped: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface InstallSkillsOptions {
|
|
8
|
+
/** Destination directory. Created if missing. */
|
|
9
|
+
dest: string;
|
|
10
|
+
/** If true, overwrite files that already exist. Default: false. */
|
|
11
|
+
force?: boolean;
|
|
12
|
+
/** Override source dir (testing only). */
|
|
13
|
+
sourceDir?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Copy all `tr-*.md` files from the bundled skills directory to `dest`.
|
|
17
|
+
* Returns a summary so callers can render output. Throws on filesystem errors
|
|
18
|
+
* the caller didn't ask for.
|
|
19
|
+
*/
|
|
20
|
+
export declare function installSkills(opts: InstallSkillsOptions): Promise<InstallSkillsResult>;
|
|
21
|
+
/**
|
|
22
|
+
* CLI entry point — parses argv (after the subcommand token has been
|
|
23
|
+
* removed) and prints human-readable output. Returns exit code.
|
|
24
|
+
*/
|
|
25
|
+
export declare function runInstallSkillsCli(args: string[]): Promise<number>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface RestCall {
|
|
2
|
+
method: string;
|
|
3
|
+
path: string;
|
|
4
|
+
query: string[];
|
|
5
|
+
body: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface RestParameter {
|
|
8
|
+
name: string;
|
|
9
|
+
in: 'path' | 'query' | 'body';
|
|
10
|
+
type: string;
|
|
11
|
+
required: boolean;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
/** One way of calling a tool (a page or a partial, say) and the REST calls and parameters it takes. */
|
|
15
|
+
export interface RestVariant {
|
|
16
|
+
calls: RestCall[];
|
|
17
|
+
parameters: RestParameter[];
|
|
18
|
+
}
|
|
19
|
+
export interface RestEntry {
|
|
20
|
+
tool: string;
|
|
21
|
+
effect: 'read' | 'write' | 'admin';
|
|
22
|
+
description: string;
|
|
23
|
+
/** Site routes live under /api/v1/sites/{siteId}/; the rest under /api/v1/. */
|
|
24
|
+
site: boolean;
|
|
25
|
+
/** Every REST call behind the tool, in recording order. */
|
|
26
|
+
calls: RestCall[];
|
|
27
|
+
variants: RestVariant[];
|
|
28
|
+
/** Said before the parameter tables of a tool with more than one way of calling it. */
|
|
29
|
+
note?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Tools that read bundled documentation and never call the API. */
|
|
32
|
+
export declare const LOCAL_TOOLS: Set<string>;
|
|
33
|
+
export declare function restReference(): Promise<RestEntry[]>;
|
|
34
|
+
/** The published reference: one section per REST call behind each MCP tool. */
|
|
35
|
+
export declare function renderRestReference(entries: RestEntry[]): string;
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Implementation } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { TyperollClient } from './client.js';
|
|
4
|
+
import { type ToolDef } from './tools/helpers.js';
|
|
5
|
+
import { type ToolEffect } from './compact-tools.js';
|
|
6
|
+
/** What permission a tool needs to run. Maps onto the share model: a
|
|
7
|
+
* read-shared site can `read`-list but cannot mutate. Mode `write` is the
|
|
8
|
+
* default — applied to anything that isn't trivially side-effect-free. */
|
|
9
|
+
/** Every MCP tool, in registration order. The REST reference is generated from it. */
|
|
10
|
+
export declare const ALL_TOOLS: ToolDef[];
|
|
11
|
+
/**
|
|
12
|
+
* Classify a tool by name into the minimum permission needed. We keep this
|
|
13
|
+
* conservative — anything that mutates is `write`. The MCP route's per-call
|
|
14
|
+
* gate then checks `effect <= sitePermission`.
|
|
15
|
+
*
|
|
16
|
+
* Naming convention is followed by the tool modules: read paths are
|
|
17
|
+
* `list_*` / `read_*` / `get_*` / `preview_*` / `search_*` / `check_*` / `find_*`; everything else
|
|
18
|
+
* mutates.
|
|
19
|
+
*/
|
|
20
|
+
export declare function effectFor(name: string): ToolEffect;
|
|
21
|
+
/**
|
|
22
|
+
* Admin tools a builder may also run: design work (colours, fonts, the Fonts
|
|
23
|
+
* library, site field definitions). A builder's personal connection reports
|
|
24
|
+
* `design` on its selected site; the REST routes check the same rule again.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DESIGN_TOOLS: ReadonlySet<string>;
|
|
27
|
+
/** Whether a site permission (and design capability) may run a tool of this effect. */
|
|
28
|
+
export declare function toolAllowed(name: string, effect: ToolEffect, permission: ToolEffect, design?: boolean): boolean;
|
|
29
|
+
export interface AllowedSite {
|
|
30
|
+
siteId: string;
|
|
31
|
+
permission: 'read' | 'write' | 'admin';
|
|
32
|
+
/** Display name — surfaced in the "site_id" arg description so the model
|
|
33
|
+
* sees a list it can pick from. */
|
|
34
|
+
name?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface BuildServerOptions {
|
|
37
|
+
/** Shared HTTP client (or test fake). Tools call this. */
|
|
38
|
+
client: TyperollClient;
|
|
39
|
+
/** Bind the server to a single site. Mutually exclusive with `allowedSites`. */
|
|
40
|
+
fixedSiteId?: string;
|
|
41
|
+
/** Multi-site mode: every tool gains a `site_id` arg, validated against this list. */
|
|
42
|
+
allowedSites?: AllowedSite[];
|
|
43
|
+
info?: Implementation;
|
|
44
|
+
toolMode?: 'full' | 'compact';
|
|
45
|
+
/** Stateless personal connections require an explicit organization/site/version selection. */
|
|
46
|
+
selection?: {
|
|
47
|
+
select(organizationId: string, siteId: string, version: string): Promise<Record<string, unknown>>;
|
|
48
|
+
resolve(context: string): Promise<{
|
|
49
|
+
client: TyperollClient;
|
|
50
|
+
siteId: string;
|
|
51
|
+
permission: ToolEffect;
|
|
52
|
+
design?: boolean;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Server identity with icons served by a Typeroll portal. Clients such as
|
|
58
|
+
* Claude show them in their connector lists; the icons are opaque tiles with
|
|
59
|
+
* a margin around the symbol, so no client crops or fills them.
|
|
60
|
+
*/
|
|
61
|
+
export declare function serverInfo(portalOrigin?: string | null): Implementation;
|
|
62
|
+
/**
|
|
63
|
+
* Server-level instructions — returned in the MCP `initialize` response and
|
|
64
|
+
* available to clients (Claude Code stdio AND the hosted
|
|
65
|
+
* Desktop/claude.ai connector) with zero user setup. Clients decide how to surface these instructions, so it carries the highest-value
|
|
66
|
+
* conventions and POINTS at the deeper, on-demand content (the bundled skills,
|
|
67
|
+
* reachable via list_skills/read_skill) rather than duplicating it.
|
|
68
|
+
*/
|
|
69
|
+
export declare const SERVER_INSTRUCTIONS: string;
|
|
70
|
+
export declare function buildServer(options: BuildServerOptions): McpServer;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type JsonLdNode = Record<string, unknown>;
|
|
3
|
+
export type StructuredDataKind = 'faq' | 'recipe' | 'event';
|
|
4
|
+
/** Invalid input or an unusable existing json_ld; `issues` name the field. */
|
|
5
|
+
export declare class StructuredDataError extends Error {
|
|
6
|
+
readonly issues: string[];
|
|
7
|
+
constructor(issues: string[]);
|
|
8
|
+
}
|
|
9
|
+
/** Input fields of add_faq_schema (besides page_id). */
|
|
10
|
+
export declare const faqSchemaShape: {
|
|
11
|
+
items: z.ZodArray<z.ZodObject<{
|
|
12
|
+
question: z.ZodString;
|
|
13
|
+
answer: z.ZodString;
|
|
14
|
+
}, z.core.$strict>>;
|
|
15
|
+
};
|
|
16
|
+
/** Input fields of add_recipe_schema (besides page_id). */
|
|
17
|
+
export declare const recipeSchemaShape: {
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
description: z.ZodOptional<z.ZodString>;
|
|
20
|
+
image_url: z.ZodOptional<z.ZodString>;
|
|
21
|
+
author: z.ZodOptional<z.ZodString>;
|
|
22
|
+
prep_time: z.ZodOptional<z.ZodString>;
|
|
23
|
+
cook_time: z.ZodOptional<z.ZodString>;
|
|
24
|
+
total_time: z.ZodOptional<z.ZodString>;
|
|
25
|
+
recipe_yield: z.ZodOptional<z.ZodString>;
|
|
26
|
+
ingredients: z.ZodArray<z.ZodString>;
|
|
27
|
+
instructions: z.ZodArray<z.ZodString>;
|
|
28
|
+
};
|
|
29
|
+
/** Input fields of add_event_schema (besides page_id). */
|
|
30
|
+
export declare const eventSchemaShape: {
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
description: z.ZodOptional<z.ZodString>;
|
|
33
|
+
start_date: z.ZodString;
|
|
34
|
+
end_date: z.ZodOptional<z.ZodString>;
|
|
35
|
+
location_name: z.ZodOptional<z.ZodString>;
|
|
36
|
+
location_address: z.ZodOptional<z.ZodString>;
|
|
37
|
+
image_url: z.ZodOptional<z.ZodString>;
|
|
38
|
+
offers_url: z.ZodOptional<z.ZodString>;
|
|
39
|
+
offers_price: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
40
|
+
offers_currency: z.ZodOptional<z.ZodString>;
|
|
41
|
+
};
|
|
42
|
+
export type FaqSchemaInput = z.infer<z.ZodObject<typeof faqSchemaShape>>;
|
|
43
|
+
export type RecipeSchemaInput = z.infer<z.ZodObject<typeof recipeSchemaShape>>;
|
|
44
|
+
export type EventSchemaInput = z.infer<z.ZodObject<typeof eventSchemaShape>>;
|
|
45
|
+
export declare function buildFaqJsonLd(input: unknown): {
|
|
46
|
+
node: JsonLdNode;
|
|
47
|
+
warnings: string[];
|
|
48
|
+
};
|
|
49
|
+
export declare function buildRecipeJsonLd(input: unknown): {
|
|
50
|
+
node: JsonLdNode;
|
|
51
|
+
warnings: string[];
|
|
52
|
+
};
|
|
53
|
+
export declare function buildEventJsonLd(input: unknown): {
|
|
54
|
+
node: JsonLdNode;
|
|
55
|
+
warnings: string[];
|
|
56
|
+
};
|
|
57
|
+
/** The three page structured-data helpers, keyed by kind. */
|
|
58
|
+
export declare const STRUCTURED_DATA: {
|
|
59
|
+
readonly faq: {
|
|
60
|
+
readonly tool: "add_faq_schema";
|
|
61
|
+
readonly type: "FAQPage";
|
|
62
|
+
readonly shape: {
|
|
63
|
+
items: z.ZodArray<z.ZodObject<{
|
|
64
|
+
question: z.ZodString;
|
|
65
|
+
answer: z.ZodString;
|
|
66
|
+
}, z.core.$strict>>;
|
|
67
|
+
};
|
|
68
|
+
readonly build: typeof buildFaqJsonLd;
|
|
69
|
+
};
|
|
70
|
+
readonly recipe: {
|
|
71
|
+
readonly tool: "add_recipe_schema";
|
|
72
|
+
readonly type: "Recipe";
|
|
73
|
+
readonly shape: {
|
|
74
|
+
name: z.ZodString;
|
|
75
|
+
description: z.ZodOptional<z.ZodString>;
|
|
76
|
+
image_url: z.ZodOptional<z.ZodString>;
|
|
77
|
+
author: z.ZodOptional<z.ZodString>;
|
|
78
|
+
prep_time: z.ZodOptional<z.ZodString>;
|
|
79
|
+
cook_time: z.ZodOptional<z.ZodString>;
|
|
80
|
+
total_time: z.ZodOptional<z.ZodString>;
|
|
81
|
+
recipe_yield: z.ZodOptional<z.ZodString>;
|
|
82
|
+
ingredients: z.ZodArray<z.ZodString>;
|
|
83
|
+
instructions: z.ZodArray<z.ZodString>;
|
|
84
|
+
};
|
|
85
|
+
readonly build: typeof buildRecipeJsonLd;
|
|
86
|
+
};
|
|
87
|
+
readonly event: {
|
|
88
|
+
readonly tool: "add_event_schema";
|
|
89
|
+
readonly type: "Event";
|
|
90
|
+
readonly shape: {
|
|
91
|
+
name: z.ZodString;
|
|
92
|
+
description: z.ZodOptional<z.ZodString>;
|
|
93
|
+
start_date: z.ZodString;
|
|
94
|
+
end_date: z.ZodOptional<z.ZodString>;
|
|
95
|
+
location_name: z.ZodOptional<z.ZodString>;
|
|
96
|
+
location_address: z.ZodOptional<z.ZodString>;
|
|
97
|
+
image_url: z.ZodOptional<z.ZodString>;
|
|
98
|
+
offers_url: z.ZodOptional<z.ZodString>;
|
|
99
|
+
offers_price: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
100
|
+
offers_currency: z.ZodOptional<z.ZodString>;
|
|
101
|
+
};
|
|
102
|
+
readonly build: typeof buildEventJsonLd;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* JSON Schema of a helper's input including `page_id`, for tool definitions
|
|
107
|
+
* outside MCP (the portal chat passes it to the model as input_schema).
|
|
108
|
+
*/
|
|
109
|
+
export declare function structuredDataInputSchema(kind: StructuredDataKind): {
|
|
110
|
+
type: 'object';
|
|
111
|
+
properties: Record<string, unknown>;
|
|
112
|
+
required?: string[];
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Combine a page's existing json_ld string with a new node. Nodes of the same
|
|
116
|
+
* @type are replaced; other nodes are kept. Returns the json_ld string to
|
|
117
|
+
* store. An existing value that is not a JSON object/array is refused rather
|
|
118
|
+
* than silently overwritten.
|
|
119
|
+
*/
|
|
120
|
+
export declare function mergeJsonLd(existing: string | null | undefined, node: JsonLdNode): {
|
|
121
|
+
json_ld: string;
|
|
122
|
+
replaced: number;
|
|
123
|
+
kept: number;
|
|
124
|
+
};
|
package/dist/tools/access.js
CHANGED
|
@@ -12,13 +12,13 @@ const ROLES = 'Roles: owner (everything, including the organization itself), adm
|
|
|
12
12
|
export const accessTools = [
|
|
13
13
|
{
|
|
14
14
|
name: 'list_api_keys',
|
|
15
|
-
description: 'List this Site\'s site-scoped API keys: id (prefix), name, created_at/created_by, last_used_at/last_used_ip and revoked_at. Never returns secrets or hashes. Requires admin on the Site, as in Site settings → API keys.',
|
|
15
|
+
description: 'List this Site\'s site-scoped API keys: id (prefix), name, created_at/created_by, last_used_at/last_used_ip and revoked_at. Never returns secrets or hashes. Requires admin on the Site, as in Site settings → API keys. A caller that reaches the Site through a share gets the list without created_by and last_used_ip.',
|
|
16
16
|
inputSchema: {},
|
|
17
17
|
handler: withErrorBoundary(async (_args, { client, siteId }) => ok(await client.get(siteId, 'api-keys'))),
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
name: 'revoke_api_key',
|
|
21
|
-
description: 'Revoke one of this Site\'s API keys (admin permission on the Site). It stops authenticating immediately and stays listed as revoked for audit. Revoking the key this connection uses ends the connection. Organization keys are revoked with revoke_organization_api_key.',
|
|
21
|
+
description: 'Revoke one of this Site\'s API keys (admin permission on the Site). It stops authenticating immediately and stays listed as revoked for audit. Revoking the key this connection uses ends the connection. A caller that reaches the Site through a share cannot revoke keys the owning organization created (403). Organization keys are revoked with revoke_organization_api_key.',
|
|
22
22
|
inputSchema: { key_id: keyId },
|
|
23
23
|
handler: withErrorBoundary(async (args, { client, siteId }) => ok(await client.del(siteId, `api-keys/${encodeURIComponent(args.key_id)}`))),
|
|
24
24
|
},
|
package/dist/tools/bulk.js
CHANGED
|
@@ -18,7 +18,7 @@ export const bulkTools = [
|
|
|
18
18
|
inputSchema: {
|
|
19
19
|
pattern: z.string().min(1).describe('Literal substring (default) or JS regex source if regex=true.'),
|
|
20
20
|
replacement: z.string(),
|
|
21
|
-
regex: z.boolean().optional().describe('Treat pattern as a regex source. Always case-insensitive + global.'),
|
|
21
|
+
regex: z.boolean().optional().describe('Treat pattern as a regex source. Always case-insensitive + global. Same limits as search_pages regex: at most 200 characters, no backreferences, nested quantifiers or overlapping repeated parts, text values up to 50,000 characters and a matching-work budget checked before native evaluation. A refused pattern writes nothing.'),
|
|
22
22
|
scope: z.enum(['pages', 'partials', 'all']).optional().describe('Resource family to scan. Defaults to pages.'),
|
|
23
23
|
page_ids: z.array(z.string()).optional().describe('Restrict to these page ids. Omit to apply to every matching page.'),
|
|
24
24
|
content_type: z.string().optional().describe('Restrict replacement to Pages of this content type.'),
|
package/dist/tools/collection.js
CHANGED
|
@@ -38,7 +38,7 @@ export const collectionTools = [
|
|
|
38
38
|
name: 'add_package_to_collection',
|
|
39
39
|
description: 'Add a Typeroll package (.typeroll) to the organization collection without changing the site. A collection package becomes one entry per block template, page template, free global block and block type, each with what it depends on; a site package is kept whole as one entry of kind "package". Its menus, design, settings pages and font files are not entries. The source package, publisher and verified signature are recorded. Returns 201 { entries, warnings }.',
|
|
40
40
|
inputSchema: {
|
|
41
|
-
data_base64: z.string().optional().describe('The .typeroll file, base64-encoded (at most
|
|
41
|
+
data_base64: z.string().optional().describe('The .typeroll file, base64-encoded (at most 16 MB). Send this or source_url.'),
|
|
42
42
|
source_url: z.string().optional().describe('An https:// address to download the package from (up to 200 MB).'),
|
|
43
43
|
},
|
|
44
44
|
handler: withErrorBoundary(async (args, { client, siteId }) => ok(await client.post(siteId, 'collection/import', Object.fromEntries(Object.entries(args).filter(([, value]) => value !== undefined))))),
|
package/dist/tools/deploy.js
CHANGED
|
@@ -50,9 +50,10 @@ export const deployTools = [
|
|
|
50
50
|
{
|
|
51
51
|
name: 'get_deploy_status',
|
|
52
52
|
description: "Status of a single deploy job. Optional top-level build_progress reports the exact task status, attempt, step and completed/total files; not an overall percentage or ETA. Media preparation runs in windows of about 12 minutes that each save their position, so attempt rises in a healthy build: media_continuations counts those planned windows, retries counts failed runs started again, and deadline is when the build stops for good. Do not cancel while completed still rises. While a build or verification step waits for a runner, build_progress.status is queued, deadline is null (its working time starts when a runner claims it) and build_progress.queue says why: { state, message, queued_at, queued_for_seconds, provider, provider_status, ahead, ahead_kinds, running_kinds, expires_at }. state waiting_for_provider means nothing in this organization is ahead and the provider has not started a runner yet (provider_status is the provider's own status, e.g. queued or initializing; running_kinds lists this organization's other builds on the same account, such as media_preparation); waiting_for_other_builds means ahead other builds of this organization run first. job.phase carries the same message. A queued build is normal and can wait many minutes: keep polling (every 30–60 s is enough) and do not retrigger, cancel or start another publication. Only a step that no runner claims by expires_at (6 hours) fails, with job.failure.code build_queue_timeout. Returns { job, queued_for_seconds, queue_timeout_seconds }. job.targets and job.production, when present, record where the publication was admitted to publish and whether that included a live domain. job.status is one of queued | running | succeeded | failed. On a failed build, job.error names the failed step and the cause the step printed, job.failure.code is the reported code (e.g. media_build_process_exit_1) and job.failure.diagnostic holds { cause, lines } (the last 40 lines that step printed, credentials removed). On the Cloudflare build engine job.failure.provider_log also holds { step, build_id, summary, lines } from the provider's build log (last 60 lines). Read them before retrying; retrying does not fix a cause that is in the content or the build engine. From Core 0.3.55, job.pages_cache_retention records removed public URLs retained by Pages after exact static candidate verification: each entry includes origin, route, checked_at, actual_status 200, expected_status 404, uncached_status 404 and safe cache headers. A succeeded job with these observations is published with a cache warning, not proof of immediate public removal; report it to the user and do not rebuild to clear the cache. Current file bytes and exact candidate checks must still pass. job.warnings, when present, lists non-blocking findings of a deploy that still ran, for example a media file left out of the publication because it could not be published safely (an SVG that could not be sanitized) or because it was missing and the deploy accepted that (accept_missing_media); report them to the user. A failed job with job.failure.code media_missing lists the referenced files whose copy to media storage failed in job.failure.missing_media (at most 100; missing_media_total counts them all): retry the media migration or re-import them, or ask the owner whether to publish with accept_missing_media: true. Polling cadence: ~5s for queued/running. job.render_report, when present, reports actual HTML mode (full/partial), rendered, reused, total and removed route counts plus a fallback reason. From Core 0.3.53, optional render_report.cache separates read/save state, encoding, retained/omitted routes, bounded byte counts, renderer/global/runtime invalidations and transfer/storage failures. Transfer details require an updated organization engine; inspect them before retrying a full-render publication. From Core 0.2.17, custom blocks and consumed image metadata are tracked per route; older caches require one full build. It does not measure media or provider startup savings. job.coordinator, when present, reports the last completed CMS phase and duration_ms for that attempt; external build waiting is excluded. Keep observing the same job across checkpoints; do not trigger duplicate deploys. A job whose own status stays 'queued' (not a queued build step, which runs under job.status running) for longer than queue_timeout_seconds (default 300s) auto-flips to failed with phase='queue_timeout' — so a single poll past that timestamp returns the terminal state and you can stop polling.",
|
|
53
|
-
inputSchema: { job_id: z.string(), include_provider: z.boolean().optional().describe('Also read the exact Git commit and Cloudflare build stages for a customer Git publication. Does not return build secrets.') },
|
|
53
|
+
inputSchema: { job_id: z.string(), diagnostics: z.boolean().optional().describe('Read bounded numeric build phase/media timings. For an older Cloudflare engine, reads the completed job\'s provider log once; returns no raw logs or credentials and starts no build. Missing measurements are not zero.'), include_provider: z.boolean().optional().describe('Also read the exact Git commit and Cloudflare build stages for a customer Git publication. Does not return build secrets.') },
|
|
54
54
|
handler: withErrorBoundary(async (args, { client, siteId }) => {
|
|
55
|
-
const
|
|
55
|
+
const route = `deploys/${encodeURIComponent(args.job_id)}`;
|
|
56
|
+
const res = args.diagnostics ? await client.get(siteId, route, { diagnostics: '1' }) : await client.get(siteId, route);
|
|
56
57
|
if (args.include_provider)
|
|
57
58
|
return ok({ ...res, provider_build: await client.get(siteId, 'publishing/build', { job_id: args.job_id }) });
|
|
58
59
|
return ok(res);
|
package/dist/tools/domain.js
CHANGED
|
@@ -154,7 +154,7 @@ export const domainTools = [
|
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
156
|
name: 'read_site_hosting_group',
|
|
157
|
-
description: 'Read the selected site Hosting Group and eligible organization groups. Omitted legacy assignments resolve to Default.',
|
|
157
|
+
description: 'Read the selected site Hosting Group and eligible organization groups. Omitted legacy assignments resolve to Default. A caller that reaches the site through a share sees only the selected group.',
|
|
158
158
|
inputSchema: {},
|
|
159
159
|
handler: withErrorBoundary(async (_args, { client, siteId }) => ok(await client.get(siteId, 'publishing/hosting-group'))),
|
|
160
160
|
},
|
|
@@ -256,11 +256,17 @@ export const domainTools = [
|
|
|
256
256
|
{
|
|
257
257
|
name: 'read_domain',
|
|
258
258
|
description: "Read the current state of the site's custom domain. Returns " +
|
|
259
|
-
'`{ hostname, status, dns_target, verified_at, failure_reason }` ' +
|
|
259
|
+
'`{ hostname, status, dns_target, verified_at, failure_reason, requirements, notes, alias }` ' +
|
|
260
260
|
"or `null` when no domain is attached. Status is one of 'pending' " +
|
|
261
261
|
"(DNS not yet verified), 'verified' (DNS + cert OK, awaiting customer " +
|
|
262
262
|
"activation), 'live' (production URL is now the custom domain), " +
|
|
263
|
-
"'failed' (Cloudflare returned an error — see failure_reason)."
|
|
263
|
+
"'failed' (Cloudflare returned an error — see failure_reason). " +
|
|
264
|
+
"`requirements` lists the DNS records to add, each `{ phase, type, name, content, status }`: " +
|
|
265
|
+
"phase 'validation' proves ownership (for example a TXT record), 'traffic' routes visitors; " +
|
|
266
|
+
"status 'required' still has to be added, 'configured' was found. A pending domain with required " +
|
|
267
|
+
"records is waiting for them, not failing: show the user exactly these records and the `notes`. " +
|
|
268
|
+
"`alias` carries the same fields for the other hostname of an apex/www pair. " +
|
|
269
|
+
"Older servers omit requirements and notes; then point a CNAME at dns_target.",
|
|
264
270
|
inputSchema: {},
|
|
265
271
|
handler: withErrorBoundary(async (_args, { client, siteId }) => {
|
|
266
272
|
const res = await client.get(siteId, 'domain');
|
|
@@ -272,7 +278,8 @@ export const domainTools = [
|
|
|
272
278
|
description: "Attach a custom domain to this site. The site MUST NOT already have " +
|
|
273
279
|
"a domain set — remove the existing one first. Declaring the domain " +
|
|
274
280
|
"makes it canonical immediately and queues a production deploy by " +
|
|
275
|
-
"default; point DNS only after that deploy. Returns the
|
|
281
|
+
"default; point DNS only after that deploy. Returns the domain state as " +
|
|
282
|
+
"read_domain does: add the DNS records in `requirements` (or a CNAME to dns_target when none are listed). " +
|
|
276
283
|
"Use `poll_domain` to observe DNS/SSL verification. There is no separate " +
|
|
277
284
|
"activation step in the current domain-first workflow.",
|
|
278
285
|
inputSchema: {
|
|
@@ -298,7 +305,8 @@ export const domainTools = [
|
|
|
298
305
|
description: "Ask Cloudflare for the current state of the attached domain and " +
|
|
299
306
|
"update the site doc accordingly. Idempotent — call after DNS " +
|
|
300
307
|
"changes propagate. Returns the new state; status may have advanced " +
|
|
301
|
-
"from 'pending' to 'verified' or 'failed'."
|
|
308
|
+
"from 'pending' to 'verified' or 'failed'. While pending, `requirements` " +
|
|
309
|
+
"shows which DNS records are still required and which were found.",
|
|
302
310
|
inputSchema: {},
|
|
303
311
|
handler: withErrorBoundary(async (_args, { client, siteId }) => {
|
|
304
312
|
const res = await client.post(siteId, 'domain/poll');
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ToolDef } from './helpers.js';
|
|
2
|
+
export declare const extensionTools: ToolDef[];
|
|
3
|
+
/** Extension developer tools — the `typeroll extension` CLI's API. They act on
|
|
4
|
+
* the key's own organization, not on a site, and need an
|
|
5
|
+
* organization-scoped key (a site key gets 403). */
|
|
6
|
+
export declare const developerExtensionTools: ToolDef[];
|
package/dist/tools/forms.js
CHANGED
|
@@ -48,7 +48,7 @@ const optionSourceSchema = z.object({ field: z.string(), type: z.string(), confi
|
|
|
48
48
|
const actionSchema = z.object({
|
|
49
49
|
id: z.string().optional().describe('Keep an existing action\'s id to update it in place (webhooks keep their stored secret).'),
|
|
50
50
|
type: z.string().describe('"email", "webhook", or an action type provided by an installed app (see get_form_capabilities).'),
|
|
51
|
-
config: z.record(z.string(), z.unknown()).describe('email: { to, subject, body, cc?, bcc?, reply_to?, include_all?, format?: "html"|"text" } — to/subject/body may use {{field}} placeholders, e.g. to: "{{email}}" for a confirmation to the visitor. ' +
|
|
51
|
+
config: z.record(z.string(), z.unknown()).describe('email: { to, subject, body, cc?, bcc?, reply_to?, include_all?, format?: "html"|"text" } — to/subject/body may use {{field}} placeholders, e.g. to: "{{email}}" for a confirmation to the visitor. include_all appends every submitted value, but only when to, cc and bcc are fixed addresses; with a {{field}} recipient it is ignored and the email contains only its subject and body. ' +
|
|
52
52
|
'webhook: { url (https), fields: ["name","email"] (only these values are sent), secret (signing secret; send "••••••••" to keep the stored one) }.'),
|
|
53
53
|
trigger: z.enum(['complete', 'partial_abandoned']).optional().describe('When the action runs. "complete" (default): after the final step. "partial_abandoned" (email actions only, opt-in): once per submission when a partial submission (visitor finished at least one step) has not advanced for after_hours hours; never for completed submissions. The email lists the answers given so far.'),
|
|
54
54
|
after_hours: z.number().int().min(1).max(720).optional().describe('For trigger "partial_abandoned": hours without progress before the email is sent.'),
|