feat(pipedrive): added sort order to endpoints that support it

This commit is contained in:
Waleed Latif
2026-02-17 14:44:13 -08:00
parent cdacb796a8
commit f3b1aa327f
5 changed files with 23 additions and 1 deletions

View File

@@ -151,6 +151,7 @@ Retrieve files from Pipedrive with optional filters
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `sort` | string | No | Sort files by field \(supported: "id", "update_time"\) |
| `limit` | string | No | Number of results to return \(e.g., "50", default: 100, max: 100\) |
| `start` | string | No | Pagination start offset \(0-based index of the first item to return\) |
| `downloadFiles` | boolean | No | Download file contents into file outputs |

View File

@@ -33,6 +33,7 @@ interface PipedriveApiResponse {
const PipedriveGetFilesSchema = z.object({
accessToken: z.string().min(1, 'Access token is required'),
sort: z.string().optional().nullable(),
limit: z.string().optional().nullable(),
start: z.string().optional().nullable(),
downloadFiles: z.boolean().optional().default(false),
@@ -58,11 +59,12 @@ export async function POST(request: NextRequest) {
const body = await request.json()
const validatedData = PipedriveGetFilesSchema.parse(body)
const { accessToken, limit, start, downloadFiles } = validatedData
const { accessToken, sort, limit, start, downloadFiles } = validatedData
const baseUrl = 'https://api.pipedrive.com/v1/files'
const queryParams = new URLSearchParams()
if (sort) queryParams.append('sort', sort)
if (limit) queryParams.append('limit', limit)
if (start) queryParams.append('start', start)

View File

@@ -215,6 +215,17 @@ Return ONLY the date string in YYYY-MM-DD format - no explanations, no quotes, n
placeholder: 'New deal title ',
condition: { field: 'operation', value: ['update_deal'] },
},
{
id: 'sort',
title: 'Sort By',
type: 'dropdown',
options: [
{ label: 'ID', id: 'id' },
{ label: 'Update Time', id: 'update_time' },
],
value: () => 'id',
condition: { field: 'operation', value: ['get_files'] },
},
{
id: 'limit',
title: 'Limit',

View File

@@ -16,6 +16,12 @@ export const pipedriveGetFilesTool: ToolConfig<PipedriveGetFilesParams, Pipedriv
visibility: 'hidden',
description: 'The access token for the Pipedrive API',
},
sort: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Sort files by field (supported: "id", "update_time")',
},
limit: {
type: 'string',
required: false,
@@ -44,6 +50,7 @@ export const pipedriveGetFilesTool: ToolConfig<PipedriveGetFilesParams, Pipedriv
}),
body: (params) => ({
accessToken: params.accessToken,
sort: params.sort,
limit: params.limit,
start: params.start,
downloadFiles: params.downloadFiles,

View File

@@ -443,6 +443,7 @@ export interface PipedriveUpdateDealResponse extends ToolResponse {
// GET Files
export interface PipedriveGetFilesParams {
accessToken: string
sort?: string
limit?: string
start?: string
downloadFiles?: boolean