autotask_update_contract
Partially update an existing Autotask contract by providing its ID and only the fields to modify.
Instructions
Update an existing Contract in Autotask (PATCH). Pass only fields you want to change; everything except id is optional. status: 1=In Effect, 0=Inactive.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Contract ID to update | |
| companyID | No | Company ID | |
| contractName | No | Contract name | |
| contractType | No | Contract type picklist ID | |
| contractCategory | No | Contract category picklist ID | |
| startDate | No | Contract start date (ISO YYYY-MM-DD) | |
| endDate | No | Contract end date (ISO YYYY-MM-DD) | |
| contactID | No | Primary contact ID | |
| contractNumber | No | External-facing contract number | |
| contractPeriodType | No | Period type picklist ID | |
| description | No | Contract description / notes | |
| estimatedCost | No | Estimated cost | |
| estimatedHours | No | Estimated hours | |
| estimatedRevenue | No | Estimated revenue | |
| setupFee | No | Setup fee amount | |
| overageBillingRate | No | Overage billing rate | |
| serviceLevelAgreementID | No | SLA ID | |
| purchaseOrderNumber | No | Customer purchase order number | |
| opportunityID | No | Originating opportunity ID | |
| billingPreference | No | Billing preference picklist ID | |
| billToCompanyID | No | Bill-to company ID | |
| billToCompanyContactID | No | Bill-to contact ID | |
| exclusionContractID | No | Exclusion contract ID | |
| isDefaultContract | No | Whether this is the default contract for the company | |
| internalCurrencySetupFee | No | Setup fee in internal currency | |
| internalCurrencyOverageBillingRate | No | Overage rate in internal currency | |
| organizationalLevelAssociationID | No | Org level association ID | |
| contractExclusionSetID | No | Contract exclusion set ID | |
| renewedContractID | No | ID of the contract this renewed | |
| setupFeeBillingCodeID | No | Billing code ID for the setup fee | |
| status | No | Contract status (1=In Effect, 0=Inactive) | |
| timeReportingRequiresStartAndStopTimes | No | Whether time entries require start/stop times |
Implementation Reference
- src/handlers/tool.handler.ts:1001-1004 (registration)Dispatch handler for 'autotask_update_contract' tool in the dispatch table. Calls autotaskService.updateContract(id, rest) with the id extracted from args and all other fields passed as updates.
['autotask_update_contract', async (a) => { const { id, ...rest } = a; await s.updateContract(id, rest); return { result: undefined, message: `Successfully updated contract ID: ${id}` }; }], - Schema definition for 'autotask_update_contract' tool. Defines input schema with all updatable contract fields (id required, all others optional).
name: 'autotask_update_contract', description: 'Update an existing Contract in Autotask (PATCH). Pass only fields you want to change; everything except id is optional. status: 1=In Effect, 0=Inactive.', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'Contract ID to update' }, companyID: { type: 'number', description: 'Company ID' }, contractName: { type: 'string', description: 'Contract name' }, contractType: { type: 'number', description: 'Contract type picklist ID' }, contractCategory: { type: 'number', description: 'Contract category picklist ID' }, startDate: { type: 'string', description: 'Contract start date (ISO YYYY-MM-DD)' }, endDate: { type: 'string', description: 'Contract end date (ISO YYYY-MM-DD)' }, contactID: { type: 'number', description: 'Primary contact ID' }, contractNumber: { type: 'string', description: 'External-facing contract number' }, contractPeriodType: { type: 'number', description: 'Period type picklist ID' }, description: { type: 'string', description: 'Contract description / notes' }, estimatedCost: { type: 'number', description: 'Estimated cost' }, estimatedHours: { type: 'number', description: 'Estimated hours' }, estimatedRevenue: { type: 'number', description: 'Estimated revenue' }, setupFee: { type: 'number', description: 'Setup fee amount' }, overageBillingRate: { type: 'number', description: 'Overage billing rate' }, serviceLevelAgreementID: { type: 'number', description: 'SLA ID' }, purchaseOrderNumber: { type: 'string', description: 'Customer purchase order number' }, opportunityID: { type: 'number', description: 'Originating opportunity ID' }, billingPreference: { type: 'number', description: 'Billing preference picklist ID' }, billToCompanyID: { type: 'number', description: 'Bill-to company ID' }, billToCompanyContactID: { type: 'number', description: 'Bill-to contact ID' }, exclusionContractID: { type: 'number', description: 'Exclusion contract ID' }, isDefaultContract: { type: 'boolean', description: 'Whether this is the default contract for the company' }, internalCurrencySetupFee: { type: 'number', description: 'Setup fee in internal currency' }, internalCurrencyOverageBillingRate: { type: 'number', description: 'Overage rate in internal currency' }, organizationalLevelAssociationID: { type: 'number', description: 'Org level association ID' }, contractExclusionSetID: { type: 'number', description: 'Contract exclusion set ID' }, renewedContractID: { type: 'number', description: 'ID of the contract this renewed' }, setupFeeBillingCodeID: { type: 'number', description: 'Billing code ID for the setup fee' }, status: { type: 'number', description: 'Contract status (1=In Effect, 0=Inactive)' }, timeReportingRequiresStartAndStopTimes: { type: 'number', description: 'Whether time entries require start/stop times' } }, required: ['id'] } }, - src/services/autotask.service.ts:864-874 (handler)AutotaskService.updateContract method that performs the actual API call. Delegates to http.update('Contracts', id, updates) which sends a PATCH request to /Contracts with body {id, ...updates}.
async updateContract(id: number, updates: Partial<AutotaskContract>): Promise<void> { const http = await this.ensureClient(); try { this.logger.debug(`Updating contract ${id}:`, updates); await http.update('Contracts', id, updates as Record<string, any>); this.logger.info(`Contract ${id} updated successfully`); } catch (error) { this.logger.error(`Failed to update contract ${id}:`, error); throw error; } } - Low-level HTTP update helper. Sends PATCH /{Entity} with body {id, ...fields} which is the correct Autotask REST pattern for updates.
/** * PATCH /{Entity} with body `{id, ...fields}`. This is the Autotask update * pattern — there is NO PATCH /{Entity}/{id} route (the SDK's default * generates one and gets 405 Method Not Allowed for every update). */ async update(entity: string, id: number, body: Record<string, any>): Promise<void> { await this.request<void>('PATCH', `/${entity}`, { id, ...body }); }