json-rpc

Implement JSON-RPC 2.0 servers with allowlisted method dispatch and schema-validated params.

3|1|Updated Dec 3, 2025
One-click install
npx skills add https://github.com/Probably-Group/Dev-AID --skill json-rpc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: json-rpc
Source: https://github.com/Probably-Group/Dev-AID/tree/main/.dev-aid/skills/expert/json-rpc
Command: npx skills add https://github.com/Probably-Group/Dev-AID --skill json-rpc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you implement JSON-RPC 2.0 servers and clients without common security and reliability pitfalls like method injection, unsafe parameter handling, and incorrect error responses.

Core Features & Use Cases

  • Safe method dispatch: Enforces an explicit allowlist of method names to prevent user-controlled execution.
  • Strict params validation: Validates request and params with schemas (e.g., Zod) before any method runs.
  • Correct protocol behavior: Supports single and batch requests, uses proper JSON-RPC 2.0 error codes, and handles notifications (no response when id is absent).

Quick Start

Ask your AI to generate a JSON-RPC 2.0 server that routes only allowlisted methods, validates params with Zod, limits batch size, and returns sanitized error objects with standard error codes.

Frequently Asked Questions about json-rpc

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a secure JSON-RPC 2.0 server with schema validation?

Build a secure JSON-RPC 2.0 server by enforcing an explicit allowlist of method names to prevent method injection and validating request parameters with schemas like Zod before dispatch. This ensures safe method routing and predictable execution without common security pitfalls.

What is the correct way to handle batch requests in JSON-RPC?

Handling batch requests in JSON-RPC requires bounding the batch processing size and returning proper JSON-RPC 2.0 error codes for any invalid items. Correct protocol behavior also dictates using notification semantics where responses are omitted when the request id is absent.

Why does my JSON-RPC server return leaky error responses?

Your JSON-RPC server returns leaky error responses because it lacks sanitized error object generation and strict protocol compliance. Implementing a secure protocol layer ensures non-leaky error responses by applying standard JSON-RPC 2.0 error codes instead of raw stack traces.

Can I use JSON-RPC for MCP-compatible transports?

Yes, you can use JSON-RPC for MCP-compatible transports by implementing a secure protocol layer that satisfies strict version compliance and method registries. This applies directly to building robust servers and clients requiring batch support and notification semantics.

How do I prevent user-controlled execution in RPC method routing?

Prevent user-controlled execution in RPC method routing by applying allowlisted method dispatch, which strictly enforces an explicit list of permitted method names. This prevents method injection by rejecting any user-supplied method names outside the approved registry.