public static getSpec()

in server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/lspApplyWorkspaceEdit.ts [88:162]


    public static getSpec() {
        return {
            name: 'lspApplyWorkspaceEdit',
            description:
                'Apply edits to one or more documents that are currently open in the editor. ' +
                'This tool is useful for making changes to files the user is currently working on.',
            inputSchema: {
                type: 'object',
                properties: {
                    edit: {
                        type: 'object',
                        description: 'The workspace edit to apply',
                        properties: {
                            changes: {
                                type: 'object',
                                description: 'Map of document URIs to text edits',
                                additionalProperties: {
                                    type: 'array',
                                    items: {
                                        type: 'object',
                                        properties: {
                                            range: {
                                                type: 'object',
                                                description: 'The range of text to replace',
                                                properties: {
                                                    start: {
                                                        type: 'object',
                                                        description: 'The start position',
                                                        properties: {
                                                            line: {
                                                                type: 'number',
                                                                description: 'Line position (zero-based)',
                                                            },
                                                            character: {
                                                                type: 'number',
                                                                description: 'Character position (zero-based)',
                                                            },
                                                        },
                                                        required: ['line', 'character'],
                                                    },
                                                    end: {
                                                        type: 'object',
                                                        description: 'The end position',
                                                        properties: {
                                                            line: {
                                                                type: 'number',
                                                                description: 'Line position (zero-based)',
                                                            },
                                                            character: {
                                                                type: 'number',
                                                                description: 'Character position (zero-based)',
                                                            },
                                                        },
                                                        required: ['line', 'character'],
                                                    },
                                                },
                                                required: ['start', 'end'],
                                            },
                                            newText: {
                                                type: 'string',
                                                description: 'The new text to replace with',
                                            },
                                        },
                                        required: ['range', 'newText'],
                                    },
                                },
                            },
                        },
                        required: ['changes'],
                    },
                },
                required: ['edit'],
            } as const,
        }
    }