Tool Calling

استدعاء الأدوات

GLS-000126

Advancedai-prompting1 min read
function callingtool useai toolsllm toolsclaude tool useopenai functions

Definition

A feature that lets an AI model call external functions or APIs during a response to get real data or take actions.

ميزة تتيح لنموذج AI استدعاء دوال أو APIs خارجية أثناء الاستجابة للحصول على بيانات حقيقية أو اتخاذ إجراءات.

Why It Matters

Tool calling is what makes AI agents powerful. Without it, an AI can only generate text — with it, it can read files, call APIs, and build real software.

استدعاء الأدوات هو ما يجعل وكلاء AI قوية. بدونه، AI يمكنه فقط توليد النص — بمعه، يمكنه قراءة الملفات واستدعاء APIs وبناء برمجيات حقيقية.

Full Definition

Tool calling (formerly 'function calling' in OpenAI) lets you define tools the AI can invoke. You describe the tools (name, description, parameters) and the AI decides when to call them based on the conversation. The AI returns a tool_call, your code executes it, and the result goes back to the AI. This connects AI to real systems: databases, APIs, filesystems.
استدعاء الأدوات (المعروف سابقًا بـ 'استدعاء الوظائف' في OpenAI) يتيح تعريف أدوات يمكن لـ AI استدعاؤها. تصف الأدوات (الاسم والوصف والمعاملات) والـ AI يقرر متى يستدعيها بناءً على المحادثة. AI يُعيد tool_call وكودك ينفّذه والنتيجة تعود إلى AI. هذا يربط AI بالأنظمة الحقيقية: قواعد البيانات وAPIs وأنظمة الملفات.

Example Usage

Claude Code uses tool calling to invoke Read, Edit, Bash, and Glob tools — letting it actually read and modify files instead of just suggesting changes.

Claude Code يستخدم استدعاء الأدوات لاستدعاء أدوات Read وEdit وBash وGlob — مما يتيح له قراءة وتعديل الملفات فعليًا بدلًا من مجرد اقتراح التغييرات.

Knowledge Graph

Avoid these mistakes when using Tool Calling:

1

Not validating tool inputs before execution (AI can call a tool with unexpected parameters)

2

Exposing destructive tools (delete file, drop database) to an AI agent without confirmation gates

Sign in to unlock guided AI explanations from AI Teacher.

Generate a Prompt

Copy this prompt and use it directly with any AI model — no setup needed.

Ready-to-Use Prompt
Help me build a project using Tool Calling.

Explain:
1. What is Tool Calling and why it matters
2. The core architecture and required tools
3. Step-by-step implementation plan
4. Common mistakes to avoid: Not validating tool inputs before execution (AI can call a tool with unexpected parameters), Exposing destructive tools (delete file, drop database) to an AI agent without confirmation gates
5. Best practices and production tips

Official Resources