From ea14be8cd8fa67316a4edd0d998ad6721246f029 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2026 15:40:31 +0000 Subject: [PATCH 1/4] fix(client): send content-type header for requests with an omitted optional body --- src/client.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index 6349fad..432ba82 100644 --- a/src/client.ts +++ b/src/client.ts @@ -697,11 +697,19 @@ export class Perplexity { return () => controller.abort(); } - private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): { + private buildBody({ options }: { options: FinalRequestOptions }): { bodyHeaders: HeadersLike; body: BodyInit | undefined; } { + const { body, headers: rawHeaders } = options; if (!body) { + // A resource method always passes a `body` key when its operation defines a + // request body, even if the caller omitted an optional body param. Keep the + // content-type for those, and only elide it for operations with no body at + // all (e.g. GET/DELETE). + if (body == null && 'body' in options) { + return this.#encoder({ body, headers: buildHeaders([rawHeaders]) }); + } return { bodyHeaders: undefined, body: undefined }; } const headers = buildHeaders([rawHeaders]); From 38e23f16b2ae2d178815bede417d33e1a4a233e8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2026 15:27:31 +0000 Subject: [PATCH 2/4] feat(api): manual updates --- .stats.yml | 4 +- src/resources/responses/responses.ts | 154 ++++++++++++++++++++++++++- 2 files changed, 155 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index abe6bc3..d04caa1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 13 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai/perplexity-6a9e741f72f36fa6c1f8ece842ba1616376107badbfdeaf6e88c5db7b9412437.yml -openapi_spec_hash: 76d7c6e6e7f84a1de30b869a7579e6b6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai/perplexity-a48f6cfc0c2120ede5bd103b3c7fce20079d5a8baece7dad3ddaf98955309329.yml +openapi_spec_hash: 5f4746838a4a9455b5413bb3f1a01b84 config_hash: 3f1487a29a16f85810ba4d77134da232 diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 495d832..141c49c 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -219,11 +219,17 @@ export namespace InputItem { } } +/** + * One item in the response output: an assistant message, retrieved tool results, + * or a record of a tool call. + */ export type OutputItem = | OutputItem.MessageOutputItem | OutputItem.SearchResultsOutputItem | OutputItem.FetchURLResultsOutputItem - | FunctionCallOutputItem; + | FunctionCallOutputItem + | OutputItem.McpListToolsOutputItem + | OutputItem.McpCallOutputItem; export namespace OutputItem { export interface MessageOutputItem { @@ -279,6 +285,68 @@ export namespace OutputItem { url: string; } } + + /** + * Tools discovered on one external MCP server at boot. Matches OpenAI's + * mcp_list_tools item. + */ + export interface McpListToolsOutputItem { + id: string; + + server_label: string; + + tools: Array; + + type: 'mcp_list_tools'; + + error?: string; + } + + export namespace McpListToolsOutputItem { + /** + * One tool discovered on a remote MCP server. + */ + export interface Tool { + /** + * The server's JSON Schema for the tool, passed through unmodified. + */ + input_schema: { [key: string]: unknown }; + + name: string; + + description?: string; + } + } + + /** + * One tool call executed against an external MCP server, modeled on OpenAI's + * mcp_call item. + */ + export interface McpCallOutputItem { + id: string; + + /** + * JSON-encoded arguments the model passed. + */ + arguments: string; + + name: string; + + server_label: string; + + type: 'mcp_call'; + + /** + * The failure string when the call failed (also returned to the model in-band); + * null on success, matching OpenAI's mcp_call. + */ + error?: string | null; + + /** + * Tool output text; empty when the call failed. + */ + output?: string; + } } /** @@ -542,6 +610,10 @@ export namespace ResponseStreamChunk { * output item (message or tool call) starts. */ export interface OutputItemAddedEvent { + /** + * One item in the response output: an assistant message, retrieved tool results, + * or a record of a tool call. + */ item: ResponsesAPI.OutputItem; output_index: number; @@ -562,6 +634,10 @@ export namespace ResponseStreamChunk { * output item (message or tool call) completes. */ export interface OutputItemDoneEvent { + /** + * One item in the response output: an assistant message, retrieved tool results, + * or a record of a tool call. + */ item: ResponsesAPI.OutputItem; output_index: number; @@ -844,6 +920,7 @@ export interface ResponsesCreateParams { | FunctionTool | ResponsesCreateParams.FinanceSearchTool | ResponsesCreateParams.SandboxTool + | ResponsesCreateParams.McpTool >; } @@ -954,6 +1031,43 @@ export namespace ResponsesCreateParams { */ type: 'sandbox'; } + + /** + * Connects a user-supplied remote MCP server. The worker discovers the server's + * tools at boot and calls them like native tools. Matches OpenAI's mcp tool. + * `require_approval`, `connector_id`, and `defer_loading` are not supported in v1 + * and are ignored if sent: every call auto-runs, and only bring-your-own + * `server_url` is honored. + */ + export interface McpTool { + /** + * Unique per request, ^[a-zA-Z0-9_-]{1,64}$. Namespaces the server's tools. + */ + server_label: string; + + /** + * HTTPS URL of the remote MCP server. + */ + server_url: string; + + type: 'mcp'; + + /** + * Optional allowlist of tool names. Empty exposes all discovered tools. + */ + allowed_tools?: Array; + + /** + * An OAuth access token that can be used with a remote MCP server, with a custom + * MCP server URL. Never logged or echoed. + */ + authorization?: string; + + /** + * Extra request headers. Never logged or echoed. + */ + headers?: { [key: string]: string }; + } } export interface ResponsesUsage { @@ -1160,6 +1274,7 @@ export interface ResponseCreateParamsBase { | FunctionTool | ResponseCreateParams.FinanceSearchTool | ResponseCreateParams.SandboxTool + | ResponseCreateParams.McpTool >; } @@ -1271,6 +1386,43 @@ export namespace ResponseCreateParams { type: 'sandbox'; } + /** + * Connects a user-supplied remote MCP server. The worker discovers the server's + * tools at boot and calls them like native tools. Matches OpenAI's mcp tool. + * `require_approval`, `connector_id`, and `defer_loading` are not supported in v1 + * and are ignored if sent: every call auto-runs, and only bring-your-own + * `server_url` is honored. + */ + export interface McpTool { + /** + * Unique per request, ^[a-zA-Z0-9_-]{1,64}$. Namespaces the server's tools. + */ + server_label: string; + + /** + * HTTPS URL of the remote MCP server. + */ + server_url: string; + + type: 'mcp'; + + /** + * Optional allowlist of tool names. Empty exposes all discovered tools. + */ + allowed_tools?: Array; + + /** + * An OAuth access token that can be used with a remote MCP server, with a custom + * MCP server URL. Never logged or echoed. + */ + authorization?: string; + + /** + * Extra request headers. Never logged or echoed. + */ + headers?: { [key: string]: string }; + } + export type ResponseCreateParamsNonStreaming = ResponsesAPI.ResponseCreateParamsNonStreaming; export type ResponseCreateParamsStreaming = ResponsesAPI.ResponseCreateParamsStreaming; } From 8d7a60426fdf7493563ef67aa18563fe6429b3ad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2026 15:28:12 +0000 Subject: [PATCH 3/4] release: 0.34.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 53ecb86..8878352 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.33.0" + ".": "0.34.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 17fa235..3353dc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.34.0 (2026-07-02) + +Full Changelog: [v0.33.0...v0.34.0](https://github.com/perplexityai/perplexity-node/compare/v0.33.0...v0.34.0) + +### Features + +* **api:** manual updates ([38e23f1](https://github.com/perplexityai/perplexity-node/commit/38e23f16b2ae2d178815bede417d33e1a4a233e8)) + + +### Bug Fixes + +* **client:** send content-type header for requests with an omitted optional body ([ea14be8](https://github.com/perplexityai/perplexity-node/commit/ea14be8cd8fa67316a4edd0d998ad6721246f029)) + ## 0.33.0 (2026-06-08) Full Changelog: [v0.32.0...v0.33.0](https://github.com/perplexityai/perplexity-node/compare/v0.32.0...v0.33.0) diff --git a/package.json b/package.json index 9c3a905..22273d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@perplexity-ai/perplexity_ai", - "version": "0.33.0", + "version": "0.34.0", "description": "The official TypeScript library for the Perplexity API", "author": "Perplexity ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index dc173dd..4819998 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.33.0'; // x-release-please-version +export const VERSION = '0.34.0'; // x-release-please-version From 38f0ddbf078278c3ef11391a30fa4c6593e3c076 Mon Sep 17 00:00:00 2001 From: rbuchmayer-pplx Date: Thu, 2 Jul 2026 08:29:34 -0700 Subject: [PATCH 4/4] chore(changelog): describe the MCP tool feature --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3353dc7..b3795cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Full Changelog: [v0.33.0...v0.34.0](https://github.com/perplexityai/perplexity-n ### Features -* **api:** manual updates ([38e23f1](https://github.com/perplexityai/perplexity-node/commit/38e23f16b2ae2d178815bede417d33e1a4a233e8)) +* **responses:** add `mcp` tool and typed `mcp_list_tools`/`mcp_call` output items ([38e23f1](https://github.com/perplexityai/perplexity-node/commit/38e23f16b2ae2d178815bede417d33e1a4a233e8)) ### Bug Fixes