Budowa wywołania JSON-RPC
id, method i params w rzeczywistej wiadomości MCP.
Budowa wywołania JSON-RPC to bezpłatna lekcja MCP Academy na CoddyKit. To lekcja 2 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej MCP Academy, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs MCP Academy zawiera 4 lekcji w sumie.
Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.
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.
Często zadawane pytania
Czy lekcja „Budowa wywołania JSON-RPC” jest bezpłatna?
Tak — pełny tekst „Budowa wywołania JSON-RPC” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu MCP Academy, przejdź na CoddyKit PRO. Kurs MCP Academy zawiera 4 lekcji w sumie.
Co nauczysz się w „Budowa wywołania JSON-RPC”?
id, method i params w rzeczywistej wiadomości MCP. Ćwiczysz MCP Academy z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.
Czy potrzebuję doświadczenia, aby zacząć MCP Academy?
Nie wymagamy żadnego doświadczenia. MCP Academy w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 2 z 4.
Ile czasu zajmuje lekcja „Budowa wywołania JSON-RPC”?
Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.
Czy mogę pisać i uruchamiać kod w tej lekcji MCP Academy?
Tak. Każda lekcja MCP Academy zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.
Wszystkie lekcje w tym kursie
- Żądania, odpowiedzi i powiadomienia
- Budowa wywołania JSON-RPC
- Uzgadnianie inicjalizacyjne
- Odczytywanie błędów w transmisji