Dodawanie argumentów do promptu
Pozwól użytkownikom uzupełnić pola przed uruchomieniem promptu.
Dodawanie argumentów do promptu 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.
Fillable Slots
A static prompt is fine, but real power comes from arguments: blanks the user fills in before the prompt runs. 🧩
Parameters Become Arguments
Each function parameter becomes a prompt argument. The host shows an input field for every one and collects the values.
@mcp.prompt()
def summarize(text: str) -> str:
return f"Summarize this:\n{text}"Slot Values into the Text
Inside the function you weave the arguments into the returned message, usually with an f-string, so the final text is personalized.
Type Hints Describe Inputs
A type hint like str or int tells the client what kind of value to expect, so it can guide and validate the user's entry.
@mcp.prompt()
def plan(topic: str, days: int) -> str:
return f"Plan {days} days about {topic}."Required by Default
An argument with no default is required: the user must supply it before the prompt can be invoked. No value, no run.
Optional with Defaults
Give a parameter a default value to make it optional. If the user skips it, your default fills in automatically.
@mcp.prompt()
def summarize(text: str, style: str = "brief") -> str:
return f"{style} summary:\n{text}"Document Each Field
Describing arguments well helps the user enter the right thing. Clear field names and a tidy docstring make the form obvious.
Validation at the Edge
The host collects and passes argument values to your function. You can still check them and raise a clear error if something is off.
More Slots, More Reuse
Several arguments turn one prompt into a flexible template. The same review prompt can target bugs, style, or security on demand.
@mcp.prompt()
def review(code: str, focus: str = "bugs") -> str:
return f"Review this for {focus}:\n{code}"Keep the Form Short
Ask only for what you truly need. Too many arguments turns a quick template into a tedious form nobody wants to fill.
From Generic to Specific
Arguments let one prompt serve many situations. You write the wording once and the user steers it with a few inputs. 🎯
Quick Check
Let's check how an argument becomes optional.
Recap: Prompt Arguments
You've got it! Function parameters become fillable arguments, type hints describe them, and defaults make them optional. ✅
Często zadawane pytania
Czy lekcja „Dodawanie argumentów do promptu” jest bezpłatna?
Tak — pełny tekst „Dodawanie argumentów do promptu” 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 „Dodawanie argumentów do promptu”?
Pozwól użytkownikom uzupełnić pola przed uruchomieniem promptu. Ć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 „Dodawanie argumentów do promptu”?
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
- Rejestrowanie pierwszego promptu
- Dodawanie argumentów do promptu
- Zwracanie wiadomości, nie tylko tekstu
- Szablon promptu do przeglądu kodu