पाठ 7 / 31

Server Primitives: Tools, Resources, Prompts

जानें कौन-सा primitive किस ज़रूरत के लिए है और उसे कौन नियंत्रित करता है।

मॉडल-नियंत्रित, app-नियंत्रित, user-नियंत्रित

Tools वे कार्रवाइयाँ हैं जिन्हें मॉडल बुलाने का निर्णय ले सकता है (tools/list, tools/call): database query करना, ticket बनाना। हर एक का नाम, विवरण और इनपुट का JSON Schema होता है, और परिणाम content items (पाठ, images, संरचित डेटा) की सूची होता है जिसमें isError flag है। Resources URIs से पहचाना जाने वाला पढ़ने-योग्य डेटा हैं (resources/list, resources/read): files, records, दस्तावेज़, आम तौर पर application या user द्वारा चुने जाते हैं, और उनमें templates व बदलाव notifications हो सकते हैं। Prompts पुनः उपयोग योग्य templates हैं जिन्हें users बुलाते हैं (prompts/list, prompts/get), जैसे slash command जो अच्छी तरह लिखा शुरुआती संदेश बनाता है। Primitive इस आधार पर चुनें कि नियंत्रण किसके पास होना चाहिए: मॉडल, app या user।

कौन-सा primitive किसके लिए

तुलना तालिका।

Primitive   Controlled by   Methods                        Example
Tool        model          tools/list, tools/call         get_order_status(order_id)
Resource    app / user     resources/list, resources/read policy://refunds (a document)
Prompt      user           prompts/list, prompts/get      /triage <ticket> template

Tool results carry content + isError. Resource and prompt names are discovered at runtime.

सब कुछ tool न बनाएँ

केवल-पढ़ने वाला संदर्भ डेटा (नीतियाँ, schemas) अक्सर resource के रूप में बेहतर बैठता है जिसे app जोड़ता है, और आम workflows prompts के रूप में। कम tools का अर्थ कम tokens और कम ग़लत calls।

त्वरित जाँच: किस primitive को user द्वारा बुलाने का इरादा है?

  • Prompts
  • Tools
  • Roots
  • Notifications
Answer

Prompts — Prompts slash commands जैसे user-नियंत्रित templates हैं।