updateConnection
Update an existing connection to a source or modify its redirect URL. Generate an authorization link to prompt users to select documents for ingestion.
Instructions
Updates a connection to a specific source. The connector parameter should be a valid SourceSync connector enum value. The clientRedirectUrl parameter is optional and can be used to specify a custom redirect URL for the connection. This will give you a authorization url which you can redirect the user to. The user will then be asked to pick the documents they want to ingest. This is useful if you want to update the connection to a different source or if you want to update the clientRedirectUrl or if you want to pick a different or new set of documents.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientRedirectUrl | No | ||
| connectionId | Yes | ||
| name | No | ||
| namespaceId | No | ||
| tenantId | No |
Implementation Reference
- src/index.ts:699-713 (handler)The handler function for the 'updateConnection' MCP tool. It extracts parameters, creates a SourceSyncApiClient using createClient, and calls client.updateConnection with the provided connectionId, name, and clientRedirectUrl, wrapped in safeApiCall for error handling.async (params) => { return safeApiCall(async () => { const { namespaceId, tenantId, connectionId, name, clientRedirectUrl } = params // Create a client with the provided API key const client = createClient({ namespaceId, tenantId }) return await client.updateConnection({ connectionId, name, clientRedirectUrl, }) }) },
- src/index.ts:695-714 (registration)Registration of the 'updateConnection' MCP tool on the McpServer instance using server.tool(), providing name, description, input schema, and handler function.server.tool( 'updateConnection', 'Updates a connection to a specific source. The connector parameter should be a valid SourceSync connector enum value. The clientRedirectUrl parameter is optional and can be used to specify a custom redirect URL for the connection. This will give you a authorization url which you can redirect the user to. The user will then be asked to pick the documents they want to ingest. This is useful if you want to update the connection to a different source or if you want to update the clientRedirectUrl or if you want to pick a different or new set of documents.', UpdateConnectionSchema.shape, async (params) => { return safeApiCall(async () => { const { namespaceId, tenantId, connectionId, name, clientRedirectUrl } = params // Create a client with the provided API key const client = createClient({ namespaceId, tenantId }) return await client.updateConnection({ connectionId, name, clientRedirectUrl, }) }) }, )
- src/schemas.ts:487-493 (schema)Zod schema definition for the 'updateConnection' tool inputs, including optional namespaceId, required connectionId, optional name and clientRedirectUrl, and optional tenantId.export const UpdateConnectionSchema = z.object({ namespaceId: namespaceIdSchema.optional(), connectionId: z.string(), name: z.string().optional(), clientRedirectUrl: z.string().optional(), tenantId: tenantIdSchema, })
- src/sourcesync.ts:286-302 (helper)The SourceSyncApiClient.updateConnection method implementation, which sends a PATCH request to `/v1/connections/${connectionId}` with the namespaceId, name, and clientRedirectUrl in the body.public async updateConnection({ connectionId, name, clientRedirectUrl, }: Omit<SourceSyncUpdateConnectionRequest, 'namespaceId'> & { connectionId: string }): Promise<SourceSyncUpdateConnectionResponse> { return this.client .url(`/v1/connections/${connectionId}`) .json({ namespaceId: this.namespaceId, name, clientRedirectUrl, } satisfies SourceSyncUpdateConnectionRequest) .patch() .json<SourceSyncUpdateConnectionResponse>() }