← 返回 Skills 市场
roryyu

Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal syntax.

作者 Rory · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
134
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install js-literals-protocol
功能描述
Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal...
使用说明 (SKILL.md)

JavaScript Literals Protocol Tool Skill

Overview

This skill establishes a new protocol for LLM to call tools using JavaScript's template literal syntax. It allows seamless integration between LLM prompts and local JavaScript functions through a tag function mechanism.

Protocol Definition

Core Concept

The protocol uses JavaScript template literals with tag functions to enable LLM to invoke local functions. This provides a natural, JavaScript-native way for LLMs to interact with tools.

Syntax Format

// Define variables
const var1 = value1;
const var2 = value2;

// Define tag function (tool)
function toolTag(strings, ...expressions) {
  // Process the strings and expressions
  // Return the result
}

// LLM invokes the tool using template literal syntax
const result = toolTag`Template ${var1} with ${var2} expressions`;

Usage Example

Basic Function Call

// Define variables
const person = "Mike";
const age = 28;

// Define a simple tool function
function describePerson(strings, personExp, ageExp) {
  const str0 = strings[0]; // "That " 
  const str1 = strings[1]; // " is a " 
  const str2 = strings[2]; // "." 
  
  const ageStr = ageExp > 99 ? "centenarian" : "youngster";
  
  return `${str0}${personExp}${str1}${ageStr}${str2}`;
}

// LLM invokes the tool
const output = describePerson`That ${person} is a ${age}.`;

console.log(output);
// Output: That Mike is a youngster.

Multi-Parameter Tool Call

// Define a calculation tool
function calculate(strings, ...nums) {
  const operation = strings.join(' ').trim();
  let result;
  
  if (operation.includes('add')) {
    result = nums.reduce((a, b) => a + b, 0);
  } else if (operation.includes('multiply')) {
    result = nums.reduce((a, b) => a * b, 1);
  }
  
  return `${operation} ${nums.join(', ')} = ${result}`;
}

// LLM invokes with multiple parameters
const sum = calculate`add ${5} ${3} ${7}`;
const product = calculate`multiply ${2} ${4} ${6}`;

console.log(sum);     // Output: add 5, 3, 7 = 15
console.log(product); // Output: multiply 2, 4, 6 = 48

Implementation Guidelines

For Developers Creating Tools

  1. Define tag functions that accept strings as the first parameter and variable expressions as rest parameters
  2. Process the template strings and expressions appropriately
  3. Return a result that provides meaningful feedback to the LLM

For LLMs Using the Protocol

  1. Use the template literal syntax with backticks
  2. Insert variables and expressions inside ${} placeholders
  3. Call the appropriate tag function as the prefix to the template literal

Benefits

  1. JavaScript Native: Uses existing JavaScript syntax that developers are familiar with
  2. Natural Integration: Seamlessly blends with JavaScript code
  3. Type Safety: Leverages JavaScript's type system
  4. Flexible: Supports multiple parameters and complex logic
  5. Readable: Provides clear, self-documenting tool calls

Limitations

  1. Requires JavaScript runtime environment
  2. Template literal syntax may need special handling in some LLM prompts
  3. Limited to JavaScript function capabilities

Example Workflow

  1. Developer defines local tool functions using tag function pattern
  2. LLM is instructed to use the JavaScript literals protocol
  3. LLM generates template literal calls to the defined tools
  4. System executes the tool calls and returns results to the LLM
  5. LLM continues interaction based on the results
安全使用建议
This skill is a documentation-only protocol for calling local JavaScript functions via template literals and is internally consistent. It does not itself install code or ask for secrets. However, if your agent or runtime will execute LLM-generated template-literal calls or arbitrary JS produced by the model, consider the runtime risk: ensure execution is sandboxed, limit which host functions/APIs are exposed to those tag functions, review generated calls before execution if possible, and prefer safe evaluation patterns (e.g., whitelist of permitted tool functions) to avoid executing untrusted code. Also note the skill's source has no homepage or author metadata—if provenance matters to you, ask the publisher for more information before trusting it in production.
功能分析
Type: OpenClaw Skill Name: js-literals-protocol Version: 1.0.0 The skill bundle defines a conceptual protocol for using JavaScript template literals as a tool-calling mechanism for LLMs. It consists entirely of documentation and usage examples in SKILL.md and README.md, with no executable code, network activity, or instructions for data exfiltration or unauthorized access. The content is purely instructional and aligns with its stated purpose of establishing a syntax for tool interaction.
能力评估
Purpose & Capability
Name/description match the content: the SKILL.md only describes a JS template-literal/tag-function protocol. No unrelated binaries, env vars, or credentials are requested.
Instruction Scope
Instructions are limited to code examples and guidelines for writing tag functions and using template literals. They do not direct reading files, accessing environment variables, or sending data to external endpoints. The doc assumes the host will execute those local functions, which is expected for a tool protocol.
Install Mechanism
No install spec and no code files are included beyond documentation; nothing will be downloaded or written to disk by installing the skill itself.
Credentials
No environment variables, credentials, or config paths are required. The declared requirements match the instructions.
Persistence & Privilege
Skill flags are default (not always). It does not request persistent or elevated privileges or modify other skills' configuration.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install js-literals-protocol
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /js-literals-protocol 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of js-literals-protocol skill. - Introduces a new protocol allowing LLMs to invoke local JavaScript functions using template literal (tagged template) syntax. - Provides implementation guidelines and usage examples for both developers and LLMs. - Highlights benefits such as natural JavaScript integration, type safety, and readability. - Documents known limitations, including dependence on a JavaScript runtime.
元数据
Slug js-literals-protocol
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal syntax. 是什么?

Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 134 次。

如何安装 Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal syntax.?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install js-literals-protocol」即可一键安装,无需额外配置。

Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal syntax. 是免费的吗?

是的,Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal syntax. 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal syntax. 支持哪些平台?

Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal syntax. 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Implements a JavaScript literal syntax-based protocol for LLM tool calls. Invoke when needing to enable LLM to call local JS functions using template literal syntax.?

由 Rory(@roryyu)开发并维护,当前版本 v1.0.0。

💬 留言讨论