Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/agent-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mondaydotcomorg/agent-toolkit",
"version": "2.0.2",
"version": "2.0.3",
"description": "monday.com agent toolkit",
"exports": {
"./mcp": {
Expand Down Expand Up @@ -49,6 +49,7 @@
},
"dependencies": {
"@mondaydotcomorg/api": "^9.0.1",
"axios": "^1.8.4",
"zod": "^3.24.2",
"zod-to-json-schema": "^3.24.5"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { ToolInputType, ToolOutputType, ToolType } from '../../../tool';
import { BaseMondayAppsTool } from '../base-tool/monday-apps-tool';
import { MondayAppsToolCategory } from '../consts/apps.consts';
import { API_ENDPOINTS, HttpMethod } from '../consts/routes.consts';
import { CreateAppFeatureResponse, createAppFeatureSchema } from './schemas/app-feature-schemas';

export class CreateAppFeatureTool extends BaseMondayAppsTool<
typeof createAppFeatureSchema.shape,
CreateAppFeatureResponse
> {
name = 'monday_apps_create_app_feature';
category = MondayAppsToolCategory.APP_FEATURE;
type: ToolType = ToolType.WRITE;

getDescription(): string {
return 'Create a new app feature for an app version';
}

getInputSchema() {
return createAppFeatureSchema.shape;
}

async execute(
input: ToolInputType<typeof createAppFeatureSchema.shape>,
): Promise<ToolOutputType<CreateAppFeatureResponse>> {
try {
const { appId, appVersionId, name, type, data } = input;

// Prepare the request body
const requestBody = {
name,
type,
data: data || {},
};

const response = await this.executeApiRequest<CreateAppFeatureResponse>(
HttpMethod.POST,
API_ENDPOINTS.APP_FEATURES.CREATE(appId, appVersionId),
{ data: requestBody },
);

const { app_feature } = response;
return {
content: `Successfully created app feature '${app_feature.name}' (ID: ${app_feature.id}) of type ${app_feature.type} for app ID ${app_feature.app_id}, version ID ${app_feature.app_version_id}. Feature state: ${app_feature.state}`,
metadata: response,
};
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
return {
content: `Failed to create app feature: ${errorMessage}`,
metadata: {
statusCode: 500,
error: errorMessage,
app_feature: {
id: 0,
app_id: input.appId,
app_version_id: input.appVersionId,
app_feature_reference_id: 0,
source_app_feature_id: null,
name: input.name,
type: input.type,
state: 'error',
user_id: 0,
data: input.data || {},
schema: null,
status: null,
client_instance_token: '',
created_at: new Date().toISOString(),
updated_at: new Date().toISOString(),
current_release: null,
configured_secret_names: [],
},
app_feature_reference: {
id: 0,
created_at: new Date().toISOString(),
updated_at: new Date().toISOString(),
live_app_feature_id: 0,
app_feature_reference_id: 0,
},
} as CreateAppFeatureResponse,
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { ToolInputType, ToolOutputType, ToolType } from '../../../tool';
import { BaseMondayAppsTool } from '../base-tool/monday-apps-tool';
import { MondayAppsToolCategory } from '../consts/apps.consts';
import { API_ENDPOINTS, HttpMethod } from '../consts/routes.consts';
import { AppFeaturesResponse, getAppFeaturesSchema } from './schemas/app-feature-schemas';

export class GetAppFeaturesTool extends BaseMondayAppsTool<typeof getAppFeaturesSchema.shape, AppFeaturesResponse> {
name = 'monday_apps_get_app_features';
category = MondayAppsToolCategory.APP_FEATURE;
type: ToolType = ToolType.READ;

getDescription(): string {
return 'Retrieve app features by app version id';
}

getInputSchema() {
return getAppFeaturesSchema.shape;
}

async execute(input: ToolInputType<typeof getAppFeaturesSchema.shape>): Promise<ToolOutputType<AppFeaturesResponse>> {
try {
const { appVersionId, type } = input;

const query: Record<string, any> = {};
if (type) {
query.type = type;
}

const response = await this.executeApiRequest<AppFeaturesResponse>(
HttpMethod.GET,
API_ENDPOINTS.APP_FEATURES.GET_ALL(appVersionId),
{ query },
);

const features = response.appFeatures || [];
const featuresCount = features.length;

const featuresSummary = features
.map((feature) => `${feature.name} (ID: ${feature.id}, Type: ${feature.type}, State: ${feature.state})`)
.join(', ');

return {
content:
`Successfully retrieved ${featuresCount} app features for app version ID ${appVersionId}${type ? ` of type ${type}` : ''}.\n` +
`Features: ${featuresSummary || 'No features found'}`,
metadata: {
...response,
statusCode: response.statusCode,
headers: response.headers,
},
};
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
return {
content: `Failed to retrieve app features: ${errorMessage}`,
metadata: {
statusCode: 500,
error: errorMessage,
appFeatures: [],
} as AppFeaturesResponse,
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { GetAppFeaturesTool } from './get-app-features';
import { CreateAppFeatureTool } from './create-app-feature';

export const appFeatureTools = [GetAppFeaturesTool, CreateAppFeatureTool];

export * from './get-app-features';
export * from './create-app-feature';
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { z } from 'zod';
import { MondayApiResponse } from '../../base-tool/monday-apps-tool';
import { AppFeatureType } from '../../consts/apps.consts';

export interface AppFeature {
id: number;
app_id: number;
app_version_id: number;
app_feature_reference_id: number;
source_app_feature_id: number | null;
name: string;
type: AppFeatureType;
state: string;
user_id: number;
data: Record<string, any>;
schema: boolean | null;
status: string | null;
[key: string]: any;
}

export interface AppFeaturesResponse extends MondayApiResponse {
appFeatures: AppFeature[];
}

export const getAppFeaturesSchema = z.object({
appVersionId: z.number().describe('The ID of the app version to get features for'),
type: z.nativeEnum(AppFeatureType).optional().describe('Filter by app feature type'),
});

export interface AppFeatureReference {
id: number;
created_at: string;
updated_at: string;
live_app_feature_id: number;
app_feature_reference_id: number;
}

export interface DetailedAppFeature extends AppFeature {
client_instance_token: string;
created_at: string;
updated_at: string;
current_release: string | null;
configured_secret_names: string[];
}

export interface CreateAppFeatureResponse extends MondayApiResponse {
app_feature: DetailedAppFeature;
app_feature_reference: AppFeatureReference;
}

export const createAppFeatureSchema = z.object({
appId: z.number().describe('The ID of the app'),
appVersionId: z.number().describe('The ID of the app version'),
name: z.string().describe('The name of the app feature'),
type: z.nativeEnum(AppFeatureType).describe('The type of the app feature'),
data: z.record(z.any()).optional().describe('Additional data for the app feature'),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { ToolInputType, ToolOutputType, ToolType } from '../../../tool';
import { BaseMondayAppsTool } from '../base-tool/monday-apps-tool';
import { MondayAppsToolCategory } from '../consts/apps.consts';
import { API_ENDPOINTS, HttpMethod } from '../consts/routes.consts';
import { AppVersionApiDataResponse, getAppVersionSchema } from './schemas/app-version-schemas';

export class GetAppVersionTool extends BaseMondayAppsTool<typeof getAppVersionSchema.shape, AppVersionApiDataResponse> {
name = 'monday_apps_get_app_version';
category = MondayAppsToolCategory.APP_VERSION;
type: ToolType = ToolType.READ;

getDescription(): string {
return 'Retrieve the app version data';
}

getInputSchema() {
return getAppVersionSchema.shape;
}

async execute(
input: ToolInputType<typeof getAppVersionSchema.shape>,
): Promise<ToolOutputType<AppVersionApiDataResponse>> {
try {
const { versionId } = input;

const response = await this.executeApiRequest<AppVersionApiDataResponse>(
HttpMethod.GET,
API_ENDPOINTS.APP_VERSIONS.GET_BY_ID(versionId),
);

return {
content:
`Successfully retrieved details for app version ID ${versionId}:\n` +
`Name: ${response.appVersion.name}\n` +
`App ID: ${response.appVersion.appId}\n` +
`Version Number: ${response.appVersion.versionNumber}\n` +
`Status: ${response.appVersion.status}`,
metadata: response,
};
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
return {
content: `Failed to retrieve app version: ${errorMessage}`,
metadata: {
appVersion: {
id: input.versionId,
name: '',
appId: 0,
versionNumber: '',
status: '',
mondayCodeConfig: {
isMultiRegion: false,
},
},
} as AppVersionApiDataResponse,
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { ToolInputType, ToolOutputType, ToolType } from '../../../tool';
import { BaseMondayAppsTool } from '../base-tool/monday-apps-tool';
import { MondayAppsToolCategory } from '../consts/apps.consts';
import { API_ENDPOINTS, HttpMethod } from '../consts/routes.consts';
import { AppVersionsApiDataResponse, getAppVersionsSchema } from './schemas/app-version-schemas';

export class GetAppVersionsTool extends BaseMondayAppsTool<
typeof getAppVersionsSchema.shape,
AppVersionsApiDataResponse
> {
name = 'monday_apps_get_app_versions';
category = MondayAppsToolCategory.APP_VERSION;
type: ToolType = ToolType.READ;

getDescription(): string {
return 'Retrieve all the app versions of an app';
}

getInputSchema() {
return getAppVersionsSchema.shape;
}

async execute(
input: ToolInputType<typeof getAppVersionsSchema.shape>,
): Promise<ToolOutputType<AppVersionsApiDataResponse>> {
try {
const { appId } = input;

const response = await this.executeApiRequest<AppVersionsApiDataResponse>(
HttpMethod.GET,
API_ENDPOINTS.APP_VERSIONS.GET_ALL(appId),
);

// Create a detailed summary of versions
const versionsSummary = response.appVersions
.map((version) =>
[
`- Version ${version.versionNumber} (ID: ${version.id})`,
` Name: ${version.name}`,
` Status: ${version.status}`,
].join('\n'),
)
.join('\n');

return {
content: `Successfully retrieved ${response.appVersions.length} versions for app ID ${appId}:\n\n${versionsSummary}`,
metadata: response,
};
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
return {
content: `Failed to retrieve app versions: ${errorMessage}`,
metadata: {
statusCode: 500,
error: errorMessage,
appVersions: [], // Add required appVersions property
} as AppVersionsApiDataResponse,
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { GetAppVersionsTool } from './get-app-versions';
import { GetAppVersionTool } from './get-app-version';

export const appVersionTools = [GetAppVersionsTool, GetAppVersionTool];

export * from './get-app-versions';
export * from './get-app-version';
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { z } from 'zod';
import { MondayApiResponse } from '../../base-tool/monday-apps-tool';

export interface AppVersionsApiDataResponse extends MondayApiResponse {
appVersions: Array<{
id: number;
name: string;
appId: number;
versionNumber: string;
status: string;
mondayCodeConfig?: {
isMultiRegion: boolean;
};
}>;
}

export interface AppVersionApiDataResponse extends MondayApiResponse {
appVersion: {
id: number;
name: string;
appId: number;
versionNumber: string;
status: string;
mondayCodeConfig?: {
isMultiRegion: boolean;
};
};
}

export const getAppVersionsSchema = z.object({
appId: z.number().describe('The ID of the app to get versions for'),
});

export const getAppVersionSchema = z.object({
versionId: z.number().describe('The ID of the app version to get'),
});
Loading