npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@brglng/pi-prompt-emulated-tool-call

v0.2.0

Published

Pi extension that emulates tool calls via prompts for chat-only models

Readme

pi-prompt-emulated-tool-call

Extension for the Pi coding agent that emulates tool calls via prompts for chat-only models that do not support native tool calling.

How it works

For each configured model, the extension injects a system-prompt section that contains the full JSON schemas of the currently active tools. When the model needs a tool it responds with exactly one plural <tool_calls> block wrapping a non-empty JSON array, optionally with ordinary text before and/or after it:

I'll read the source first.
<tool_calls>
[{"name": "read", "arguments": {"path": "src/index.ts", "offset": 1}}]
</tool_calls>
Then I'll check how it fits together.

The extension parses that block into native Pi tool calls, preserving thinking and ordinary text in before/calls/after order. Non-whitespace surrounding text is kept verbatim; whitespace-only surroundings are omitted. The JSON may optionally be wrapped in one json code fence inside the tags. Marker and fence text inside JSON argument strings remains data. Multiple blocks or malformed payloads are rejected as a whole, with format feedback and no partial conversion. Responses ending in error or aborted are neither converted nor given format feedback. Pi executes valid calls through its normal agent loop. All calls in one array run in parallel by default; if an active tool explicitly declares executionMode: "sequential", Pi's sequential execution constraint is respected. Results are injected back as a <tool_results> JSON array on the next turn. Ordinary responses without the marker pass through unchanged.

Installation

Install package from npm with Pi's package manager:

# global
pi install npm:@brglng/pi-prompt-emulated-tool-call

# project-local
pi install -l npm:@brglng/pi-prompt-emulated-tool-call

Pi loads extension entrypoint from package manifest. Create configuration files at paths below after installation.

Configuration

Create a config file at one of:

  • global: ~/.pi/agent/extensions/pi-prompt-emulated-tool-call/config.json
  • project: .pi/extensions/pi-prompt-emulated-tool-call/config.json

The shape is:

{
  "models": [
    "provider-id/model-id",
    { "model": "provider-id/model-id", "removeNativeToolFields": true }
  ]
}
  • String entries use default options.
  • Object entries may set removeNativeToolFields.
  • models may mix strings and objects.
  • A project config overrides the global config when present; models: [] disables the feature. Project config is only read when the project is trusted.
  • removeNativeToolFields defaults to false. When true, the extension removes native tool definitions, tool selection, and parallel-tool fields from the provider request payload. This covers provider-specific shapes such as Google/Vertex config.tools / config.toolConfig, Bedrock root-level toolConfig, and equivalent tools / tool_choice / toolChoice / parallel_tool_calls / parallelToolCalls fields.

Invalid JSON or an illegal model entry logs a warning and disables that config file; it does not block Pi startup.

Development

# install dev dependencies
npm install

# run tests
npm test

# typecheck
npm run typecheck

License

MPL-2.0