import { MCPTool } from './index.js';
import { ChangerawrClient } from '../client/changerawr-client.js';
export const getProjectSettingsTool: MCPTool = {
name: 'get_project_settings',
description: 'Get settings and configuration for a specific project',
inputSchema: {
type: 'object',
properties: {
projectId: {
type: 'string',
description: 'The ID of the project to get settings for',
},
},
required: ['projectId'],
},
async execute(args: { projectId: string }, client: ChangerawrClient) {
const response = await client.axios.get(`/api/projects/${args.projectId}/settings`);
return {
success: true,
data: response.data,
message: `Retrieved settings for project`,
};
},
};
export const updateProjectSettingsTool: MCPTool = {
name: 'update_project_settings',
description: 'Update settings and configuration for a specific project',
inputSchema: {
type: 'object',
properties: {
projectId: {
type: 'string',
description: 'The ID of the project to update settings for',
},
name: {
type: 'string',
description: 'The new name for the project',
},
isPublic: {
type: 'boolean',
description: 'Whether the project should be publicly visible',
},
allowAutoPublish: {
type: 'boolean',
description: 'Whether entries can be automatically published',
},
requireApproval: {
type: 'boolean',
description: 'Whether changes require admin approval',
},
defaultTags: {
type: 'array',
items: { type: 'string' },
description: 'Default tags for new changelog entries',
},
},
required: ['projectId'],
},
async execute(args: {
projectId: string;
name?: string;
isPublic?: boolean;
allowAutoPublish?: boolean;
requireApproval?: boolean;
defaultTags?: string[];
}, client: ChangerawrClient) {
const { projectId, ...updateData } = args;
const response = await client.axios.patch(`/api/projects/${projectId}/settings`, updateData);
return {
success: true,
data: response.data,
message: `Updated settings for project`,
};
},
};