
الـ MCP فيه إيه غير الـ tools؟ الـ Resources والـ Prompts ومين بيتحكم في كل واحد
- كاتب موثّق
- MCP
محتويات المقال
get_orders_schema وincident_review_template وrestart_worker. وبعد شهر، الـ feedback جه محدد بشكل غريب. المهندسين مش عارفين يبدأوا الـ incident review الرسمي وقت ما يحبوا: بيطلبوه، وClaude ساعات ينادي الـ tool بتاعة الـ template، وساعات يكتب review بالشكل اللي يعجبه. وفي نفس الوقت، الـ schema الطويلة بتاعة الـ orders بتظهر في محادثات محدش طلبها فيها، عشان Claude قرر إنها ممكن تفيد.
الفكرة الغلط الشائعة
الـ tutorials غالبًا بتبدأ بـ tool أو اتنين، وكتير منها مبيكمّلش بعد كده. الـ tool calls هي الجزء اللي بيبان: بتشوف Claude بينادي tool وبتقرا النتيجة في الـ transcript. فيه integrations فعلًا tools بس. فمن كل features الـ MCP، الـ MCP connector بتاع Claude API بيقول "only tool calls are currently supported". اسم الـ protocol نفسه بيحط الموديل في الأول، فطبيعي تفترض إن الموديل هو اللي ماسك كل حاجة فيه.
اللي بيحصل فعلًا
تلات primitives، وتلات ناس بيقرروا
tools/list، tools/call | |||
resources/list، resources/templates/list، resources/read | @server:uri | ||
prompts/list، prompts/get | /mcp__server__prompt |
الـ Tools: الموديل بيقرر، والبني آدم يقدر يقول لأ
الـ Resources: التطبيق بيقرر إيه اللي يدخل الـ context
file:///project/src/main.rs أو schema://orders. والـ clients بتعمل list للـ resources الثابتة بـ resources/list، وبتكتشف اللي ليها parameters زي travel://activities/{city}/{category} بـ resources/templates/list، وبتجيب المحتوى بـ resources/read، وتقدر تراقب التغييرات عن طريق subscriptions/listen. وبكلام الـ docs، التطبيقات "can access this information directly and decide how to use it"، سواء بإنها تختار أجزاء، أو تدوّر بالـ embeddings، أو تبعت كل حاجة للموديل. وكل resource تقدر كمان تعلن عن MIME type وannotations، زي audience قيمتها user أو assistant، وpriority من 0.0 لـ 1.0: دي إشارات الـ client يقدر يستخدمها وهو بيقرر يضيف إيه.
@ والـ resources هتظهر جنب ملفاتك، والـ reference زي @ops:schema://orders بيتجاب و"included as attachments" في رسالتك. وClaude Code كمان بيدّي Claude أدوات يعمل بيها list ويقرا الـ resources لما الـ server يدعمها. وده برضه قرار التطبيق: "التطبيق بيتحكم" معناها إن الـ host هو اللي بيحط السياسة، والـ host ممكن يختار يسيب الموديل يقرا.
الـ Prompts: اليوزر بيقرر امتى الـ workflow يبدأ
prompts/list، وprompts/get مع قيم الـ arguments بيرجّع رسايل جاهزة للمحادثة. والـ spec دقيقة في معنى "user-controlled": "This refers to who decides when the prompt is used, not who authors its content. Prompt content is defined by the server".
/ وكل واحد هيظهر كـ /servername:promptname (MCP)، أو شغّله على طول كـ /mcp__servername__promptname، والـ arguments بينها مسافات. والـ docs بتضيف إن "prompt results are injected directly into the conversation"، فشكل الـ review بييجي من الـ server بتاعك كل مرة بدل ما يبقى ارتجال من Claude. والوش التاني هنا هو الثقة: الـ server هو اللي كاتب النص ده، فتشغيل prompt كأنك بتلصق كلام الـ server في الشات بنفسك. فاتعامل مع الـ servers اللي فيها prompts بنفس الحذر اللي بتتعامل بيه مع أي كود بتسطّبه.
نعيد تنظيم الـ ops server
from mcp.server import MCPServermcp = MCPServer("ops")@mcp.tool() # Claude decides when the whole DDL enters the chatdef get_orders_schema() -> str: """Get the orders database schema.""" return read_doc("schemas/orders.sql")@mcp.tool() # the user can't start the review: Claude must choose todef incident_review_template(incident_id: str) -> str: """Get the incident review template for an incident.""" return render_review(incident_id)@mcp.tool()async def restart_worker(name: str) -> str: """Restart one queue worker by name.""" return await ops_api.restart(name)from mcp.server import MCPServermcp = MCPServer("ops")@mcp.resource("schema://orders") # attached on purpose: @ops:schema://ordersdef orders_schema() -> str: """The orders database schema, as SQL DDL.""" return read_doc("schemas/orders.sql")@mcp.prompt() # run by a person: /mcp__ops__incident_review INC-2041def incident_review(incident_id: str) -> str: """Start a blameless incident review in the team's format.""" return render_review(incident_id)@mcp.tool() # an action: the model decides, the host asks for approvalasync def restart_worker(name: str) -> str: """Restart one queue worker by name.""" return await ops_api.restart(name)restart_worker فضلت tool، لأن التأثير في العالم الحقيقي هو بالظبط القرار اللي الـ MCP سايبه للموديل، تحت قواعد الموافقة بتاعة الـ host.
تطبقها إزاي في مشروعك
قسّم الإمكانيات على حسب مين بيقرر لكل حاجة الـ server بيقدمها، اسأل مين المفروض يشغّلها: الموديل، ولا التطبيق، ولا شخص. والمجموعة الأولى بس هي اللي تبقى tools. حوّل الـ context اللي للقراية بس لـ resources الـ schemas والـ runbooks والـ configs والـ docs ياخدوا URIs ثابتة. واستخدم resource templates لعائلات الـ records، زي orders://{order_id}.حوّل الـ workflows المتكررة لـ prompts الـ reviews والتقارير والـ checklists اللي شخص بيبدأها بمزاجه تبقى prompts بشوية arguments واضحة. خلّي الـ tools للأفعال والـ queries اللايف اديها descriptions دقيقة، وسيب الـ approval flow بتاع الـ host يحمي أي حاجة ليها side effects. اختبر في كل host بتدعمه جرّب @و/في Claude Code، وجهّز fallback لما يبقى فيه host، زي الـ MCP connector بتاع الـ API، مبيفهمش غير tools.
الخلاصة
الـ MCP servers بتعرض tools وresources وprompts، مش tools بس. الـ tools الموديل بيتحكم فيها، والـ resources التطبيق، والـ prompts اليوزر. الـ resources داتا ليها URI والـ host بيقرر يحمّلها امتى؛ وClaude Code بيضيفها بـ @.الـ prompts templates كاتبها الـ server وبيشغّلها شخص، زي /mcp__ops__incident_reviewفي Claude Code.الدعم بيختلف من host للتاني: الـ MCP connector بتاع Claude API بيتعامل مع الـ tool calls بس حاليًا.
التعليقات (0)