0Pricing
MCP Academy · درس

بنية استدعاء JSON-RPC

تعرّفوا على id وmethod وparams في رسالة MCP حقيقية.

بنية استدعاء JSON-RPC درس مجاني في MCP Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في MCP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة MCP Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Open the Envelope

Let us dissect one real MCP message field by field. A JSON-RPC call is a small JSON object, and four keys carry all of its meaning.

The jsonrpc Version Tag

Every message starts with jsonrpc set to the string 2.0. It marks the dialect so both sides parse the rest the same way.

{"jsonrpc": "2.0"}

The id Ties Things Together

The id is a number or string that labels a request. The matching response repeats it, so replies never get confused across many calls.

{"jsonrpc": "2.0", "id": 42}

method Names the Action

The method string says what you want, like tools/call or resources/read. MCP groups methods with a slash, namespace before the verb.

{"method": "tools/call"}

params Carries the Inputs

The params object holds the arguments for that method. For a tool call it names the tool and the values it should receive.

{"params": {"name": "add", "arguments": {"a": 2, "b": 3}}}

A Full Request

Put the four keys together and you have a complete request. This one asks the server to run the add tool with two numbers.

{"jsonrpc": "2.0", "id": 42, "method": "tools/call",
 "params": {"name": "add", "arguments": {"a": 2, "b": 3}}}

params Is Optional

Some methods need no input at all. When that happens you simply omit params, as tools/list does when it just wants the full catalog.

{"jsonrpc": "2.0", "id": 5, "method": "tools/list"}

Named, Not Positional

MCP always passes params as a JSON object with named keys, not a bare list. Names make the arguments self-documenting and order-independent.

The Response Mirror

The reply mirrors the request: same jsonrpc, same id, but method and params are gone. In their place sits a single result field.

{"jsonrpc": "2.0", "id": 42, "result": {"content": []}}

Keys You Will See Most

Across MCP traffic you mostly meet tools/list, tools/call, resources/read, and prompts/get. Spot these methods and the intent jumps right out.

Read It at a Glance

Now any MCP line is readable: jsonrpc is the version, id pairs the reply, method is the verb, and params are the inputs. Four keys, full clarity.

Quick Check

In a JSON-RPC request, which field holds the arguments for the method?

Recap: Four Keys

You can now read any call: jsonrpc sets the version, id pairs the reply, method names the action, and params supplies its inputs. That is the whole anatomy.

الأسئلة الشائعة

هل درس «بنية استدعاء JSON-RPC» مجاني؟

نعم — نص درس «بنية استدعاء JSON-RPC» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة MCP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة MCP Academy 4 دروس في المجموع.

ماذا ستتعلم في «بنية استدعاء JSON-RPC»؟

تعرّفوا على id وmethod وparams في رسالة MCP حقيقية. تتمرن على MCP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ MCP Academy؟

لا تُشترط خبرة سابقة. MCP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.

كم من الوقت يستغرق درس «بنية استدعاء JSON-RPC»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس MCP Academy هذا؟

نعم. كل درس في MCP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. الطلبات والاستجابات والإشعارات
  2. بنية استدعاء JSON-RPC
  3. مصافحة التهيئة
  4. قراءة الأخطاء في سلك الاتصال
← العودة إلى MCP Academy