create_mock
Create a mock server for a specified collection. Optionally set workspace, environment, and access controls.
Instructions
Create a new mock server. Creates in Personal workspace if workspace not specified.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | No | Workspace ID to create the mock in | |
| mock | Yes |
Implementation Reference
- src/tools/api/mocks/index.ts:85-91 (handler)The actual handler function that executes the 'create_mock' tool logic. It makes a POST request to '/mocks' with the mock configuration, optionally filtered by workspace ID.
async createMock(args: any): Promise<ToolCallResponse> { const params: any = {}; if (args.workspace) params.workspaceId = args.workspace; const response = await this.client.post('/mocks', { mock: args.mock }, { params }); return this.createResponse(response.data); } - src/tools/api/mocks/index.ts:34-35 (registration)Routes 'create_mock' tool calls to the createMock handler method in the MockTools class.
case 'create_mock': return await this.createMock(args); - The schema definition for 'create_mock', specifying input parameters (workspace, mock object with collection/name required) and the description.
{ name: 'create_mock', description: 'Create a new mock server. Creates in Personal workspace if workspace not specified.', inputSchema: { type: 'object', properties: { workspace: { type: 'string', description: 'Workspace ID to create the mock in' }, mock: { type: 'object', required: ['collection', 'name'], properties: { collection: { type: 'string', description: 'Collection ID to mock' }, name: { type: 'string', description: 'Mock server name' }, description: { type: 'string', description: 'Mock server description' }, environment: { type: 'string', description: 'Environment ID to use' }, private: { type: 'boolean', description: 'Access control setting' }, versionTag: { type: 'string', description: 'Collection version tag' } } } }, required: ['mock'] // mock object is required for creation } }, - src/server.ts:129-129 (registration)Registration of MockTools definitions (including create_mock) into the server's tool registry.
...this.mockTools.getToolDefinitions(), - src/tools/api/mocks/index.ts:23-27 (helper)Helper method used by createMock to format the API response as a ToolCallResponse.
private createResponse(data: any): ToolCallResponse { return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; }