AgentSkillsCN

tool-examples

MCP 工具的典型应用场景。在使用工具时,可作为参考依据。

SKILL.md
--- frontmatter
name: tool-examples
description: "MCP tool'ları için örnek kullanımlar. TOOL KULLANIRKEN referans al."
allowed-tools:
  - Read
  - Bash
  - mcp__github
  - mcp__postgres
  - mcp__memory
  - mcp__filesystem
  - mcp__slack
  - mcp__sentry
  - mcp__redis
  - mcp__puppeteer

Tool Use Examples

Anthropic araştırmasına göre, tool examples %72 → %90 accuracy artışı sağlar.

GitHub MCP

PR Oluşturma

json
{
  "tool": "mcp__github__create_pull_request",
  "input": {
    "owner": "company",
    "repo": "backend-api",
    "title": "feat(auth): Add JWT refresh token support",
    "body": "## Summary\n- Implements refresh token rotation\n- Adds token expiry handling\n\n## Test Plan\n- [ ] Unit tests pass\n- [ ] Integration tests pass",
    "head": "feature/jwt-refresh",
    "base": "develop"
  }
}

Issue Oluşturma

json
{
  "tool": "mcp__github__create_issue",
  "input": {
    "owner": "company",
    "repo": "backend-api",
    "title": "[BUG] Login fails with expired session",
    "body": "## Description\nUsers see 500 error when session expires\n\n## Steps to Reproduce\n1. Login\n2. Wait 30 min\n3. Try any action\n\n## Expected\nRedirect to login\n\n## Actual\n500 error",
    "labels": ["bug", "auth", "priority:high"]
  }
}

PostgreSQL MCP

Query Çalıştırma

json
{
  "tool": "mcp__postgres__query",
  "input": {
    "sql": "SELECT id, email, created_at FROM users WHERE status = $1 ORDER BY created_at DESC LIMIT $2",
    "params": ["active", 10]
  }
}

Schema Bilgisi

json
{
  "tool": "mcp__postgres__get_schema",
  "input": {
    "table_name": "users"
  }
}

⚠️ DİKKAT:

  • Parametreli query kullan (SQL injection önleme)
  • SELECT * yerine gerekli kolonları belirt
  • LIMIT kullan (büyük result set'ler için)

Memory MCP

Bilgi Kaydetme

json
{
  "tool": "mcp__memory__store",
  "input": {
    "key": "project:auth:decisions",
    "value": {
      "decision": "JWT with refresh tokens",
      "date": "2024-01-15",
      "reason": "Scalability and stateless auth",
      "alternatives_considered": ["session-based", "OAuth only"]
    }
  }
}

Bilgi Okuma

json
{
  "tool": "mcp__memory__retrieve",
  "input": {
    "key": "project:auth:decisions"
  }
}

Key Naming Convention

code
project:<module>:<type>
  project:auth:decisions
  project:auth:config
  project:users:schema
  
session:<id>:<type>
  session:abc123:state
  session:abc123:progress

Filesystem MCP

Dosya Okuma

json
{
  "tool": "mcp__filesystem__read_file",
  "input": {
    "path": "/src/services/user-service.ts"
  }
}

Dosya Listeleme

json
{
  "tool": "mcp__filesystem__list_directory",
  "input": {
    "path": "/src/services",
    "recursive": false
  }
}

Slack MCP

Mesaj Gönderme

json
{
  "tool": "mcp__slack__post_message",
  "input": {
    "channel": "#dev-notifications",
    "text": "🚀 Deployment completed: v1.2.3 is now live on production",
    "blocks": [
      {
        "type": "section",
        "text": {
          "type": "mrkdwn",
          "text": "*Deployment Complete*\nVersion: `v1.2.3`\nEnvironment: Production"
        }
      }
    ]
  }
}

Sentry MCP

Error Raporlama

json
{
  "tool": "mcp__sentry__capture_exception",
  "input": {
    "error": "PaymentProcessingError",
    "message": "Payment gateway timeout after 30s",
    "extra": {
      "user_id": "usr_123",
      "amount": 99.99,
      "gateway": "stripe"
    },
    "tags": {
      "module": "payments",
      "severity": "high"
    }
  }
}

Redis MCP

Cache Set

json
{
  "tool": "mcp__redis__set",
  "input": {
    "key": "user:123:profile",
    "value": "{\"name\":\"John\",\"email\":\"john@example.com\"}",
    "ttl": 3600
  }
}

Cache Get

json
{
  "tool": "mcp__redis__get",
  "input": {
    "key": "user:123:profile"
  }
}

Key Patterns

code
<entity>:<id>:<type>
  user:123:profile
  user:123:sessions
  
cache:<resource>:<identifier>
  cache:api:users:list
  cache:api:products:featured

Puppeteer MCP

Sayfa Açma ve Navigate

json
{
  "tool": "mcp__puppeteer__navigate",
  "input": {
    "url": "http://localhost:3000/login"
  }
}

Screenshot Alma

json
{
  "tool": "mcp__puppeteer__screenshot",
  "input": {
    "name": "login-page",
    "fullPage": false
  }
}

Element'e Tıklama

json
{
  "tool": "mcp__puppeteer__click",
  "input": {
    "selector": "button[type='submit']"
  }
}

Form Doldurma

json
{
  "tool": "mcp__puppeteer__fill",
  "input": {
    "selector": "input[name='email']",
    "value": "test@example.com"
  }
}

Element Bekleme

json
{
  "tool": "mcp__puppeteer__waitForSelector",
  "input": {
    "selector": ".success-message",
    "timeout": 5000
  }
}

JavaScript Çalıştırma

json
{
  "tool": "mcp__puppeteer__evaluate",
  "input": {
    "script": "document.querySelector('.user-name')?.textContent"
  }
}

E2E Test Akışı Örneği

code
1. Navigate → Login sayfası
2. Fill → Email input
3. Fill → Password input
4. Click → Submit button
5. WaitForSelector → Dashboard element
6. Screenshot → Sonuç doğrulama

⚠️ DİKKAT:

  • waitForSelector ile element'in yüklenmesini bekle
  • Timeout'ları makul tut (5-10 saniye)
  • Screenshot ile kritik adımları belgele
  • Test sonrası tarayıcıyı kapat

Best Practices

✅ YAP

  • Parametreli query kullan
  • Key naming convention uygula
  • TTL ayarla (cache için)
  • Error handling ekle
  • E2E testlerde screenshot al
  • Selector'larda data-testid kullan

❌ YAPMA

  • Hardcoded değerler kullanma
  • Büyük data'yı cache'leme (>1MB)
  • Sensitive data'yı log'lama
  • Rate limit'i aşma
  • Sleep/delay yerine waitForSelector kullan