tg-set-prompt

Sets prompt templates and system prompts for TrustGraph LLM services.

Synopsis

# Set a prompt template
tg-set-prompt --id TEMPLATE_ID --prompt TEMPLATE [options]

# Set system prompt
tg-set-prompt --system SYSTEM_PROMPT

Description

The tg-set-prompt command configures prompt templates and system prompts used by TrustGraph’s LLM services. Prompt templates contain placeholders like `` that are replaced with actual values when invoked. System prompts provide global context for all LLM interactions.

Templates are stored in TrustGraph’s configuration system and can be used with tg-invoke-prompt for consistent AI interactions.

Options

Prompt Template Mode

  • --id ID: Unique identifier for the prompt template (required for templates)
  • --prompt TEMPLATE: Prompt template text with `` placeholders (required for templates)
  • --response TYPE: Response format - text or json (default: text)
  • --schema SCHEMA: JSON schema for structured responses (required when response is json)

System Prompt Mode

  • --system PROMPT: System prompt text (cannot be used with other options)

Common Options

  • -u, --api-url URL: TrustGraph API URL (default: $TRUSTGRAPH_URL or http://localhost:8088/)

Examples

Basic Prompt Template

tg-set-prompt \
  --id "greeting" \
  --prompt "Hello , welcome to !"

Question-Answer Template

tg-set-prompt \
  --id "question" \
  --prompt "Answer this question based on the context: \n\nContext: "

JSON Response Template

tg-set-prompt \
  --id "extract-info" \
  --prompt "Extract key information from: " \
  --response "json" \
  --schema '{"type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "number"}}}'

Analysis Template

tg-set-prompt \
  --id "analyze" \
  --prompt "Analyze the following  and provide insights about :\n\n\n\nFormat the response as ."

System Prompt

tg-set-prompt \
  --system "You are a helpful AI assistant. Always provide accurate, concise responses. When uncertain, clearly state your limitations."

Template Variables

Variable Syntax

Templates use `` syntax for placeholders:

# Template
"Hello , today is "

# Usage
tg-invoke-prompt greeting name="Alice" day="Monday"
# Result: "Hello Alice, today is Monday"

Common Variables

  • `` - Input text for processing
  • `` - Question to answer
  • `` - Background context
  • `` - Data to analyze
  • `` - Output format specification

Response Types

Text Response (Default)

tg-set-prompt \
  --id "summarize" \
  --prompt "Summarize this text in  words: "

JSON Response

tg-set-prompt \
  --id "classify" \
  --prompt "Classify this text: " \
  --response "json" \
  --schema '{
    "type": "object",
    "properties": {
      "category": {"type": "string"},
      "confidence": {"type": "number", "minimum": 0, "maximum": 1}
    },
    "required": ["category", "confidence"]
  }'

Use Cases

Document Processing Templates

# Document summarization
tg-set-prompt \
  --id "document-summary" \
  --prompt "Provide a  summary of this document:\n\n\n\nFocus on: "

# Key point extraction
tg-set-prompt \
  --id "extract-key-points" \
  --prompt "Extract the main points from: \n\nReturn as a bulleted list."

# Document classification
tg-set-prompt \
  --id "classify-document" \
  --prompt "Classify this document into one of these categories: \n\nDocument: " \
  --response "json" \
  --schema '{"type": "object", "properties": {"category": {"type": "string"}, "confidence": {"type": "number"}}}'

Code Analysis Templates

# Code review
tg-set-prompt \
  --id "code-review" \
  --prompt "Review this  code for  issues:\n\n\n\nProvide specific recommendations."

# Bug detection
tg-set-prompt \
  --id "find-bugs" \
  --prompt "Analyze this code for potential bugs:\n\n\n\nError context: "

# Code explanation
tg-set-prompt \
  --id "explain-code" \
  --prompt "Explain how this  code works:\n\n\n\nTarget audience: "

Data Analysis Templates

# Data insights
tg-set-prompt \
  --id "data-insights" \
  --prompt "Analyze this  data and provide insights:\n\n\n\nFocus on: "

# Trend analysis
tg-set-prompt \
  --id "trend-analysis" \
  --prompt "Identify trends in this data over :\n\n" \
  --response "json" \
  --schema '{"type": "object", "properties": {"trends": {"type": "array", "items": {"type": "string"}}}}'

Content Generation Templates

# Marketing copy
tg-set-prompt \
  --id "marketing-copy" \
  --prompt "Create  marketing copy for  targeting . Key features: "

# Technical documentation
tg-set-prompt \
  --id "tech-docs" \
  --prompt "Generate technical documentation for:\n\n\n\nInclude: "

Advanced Usage

Multi-Step Templates

# Research template
tg-set-prompt \
  --id "research" \
  --prompt "Research question: 

Available sources: 

Please:
1. Analyze the question
2. Review relevant sources
3. Synthesize findings
4. Provide conclusions

Format: "

Conditional Templates

# Adaptive response template
tg-set-prompt \
  --id "adaptive-response" \
  --prompt "Task: 
Context: 
Expertise level: 

If expertise level is 'beginner', provide simple explanations.
If expertise level is 'advanced', include technical details.
If task involves code, include examples.

Response:"

Structured Analysis Template

tg-set-prompt \
  --id "structured-analysis" \
  --prompt "Analyze: 
Criteria: 
Data: 

Provide analysis in this structure:
- Overview
- Key Findings
- Recommendations
- Next Steps" \
  --response "json" \
  --schema '{
    "type": "object",
    "properties": {
      "overview": {"type": "string"},
      "key_findings": {"type": "array", "items": {"type": "string"}},
      "recommendations": {"type": "array", "items": {"type": "string"}},
      "next_steps": {"type": "array", "items": {"type": "string"}}
    }
  }'

Template Management

# Create template collection for specific domain
domain="customer-support"
templates=(
  "greeting:Hello! I'm here to help with . What can I assist you with?"
  "escalation:I understand your frustration with . Let me escalate this to ."
  "resolution:Great! I've resolved your . Is there anything else I can help with?"
)

for template in "${templates[@]}"; do
  IFS=':' read -r id prompt <<< "$template"
  tg-set-prompt --id "${domain}-${id}" --prompt "$prompt"
done

System Prompt Configuration

General Purpose System Prompt

tg-set-prompt --system "You are a knowledgeable AI assistant. Provide accurate, helpful responses. When you don't know something, say so clearly. Always consider the context and be concise unless detail is specifically requested."

Domain-Specific System Prompt

tg-set-prompt --system "You are a technical documentation assistant specializing in software development. Focus on clarity, accuracy, and practical examples. Always include code snippets when relevant and explain complex concepts step-by-step."

Role-Based System Prompt

tg-set-prompt --system "You are a data analyst AI. When analyzing data, always consider statistical significance, potential biases, and limitations. Present findings objectively and suggest actionable insights."

Error Handling

Missing Required Fields

Exception: Must specify --id for prompt

Solution: Provide both --id and --prompt for template creation.

Invalid Response Type

Exception: Response must be one of: text json

Solution: Use only text or json for the --response option.

Invalid JSON Schema

Exception: JSON schema must be valid JSON

Solution: Validate JSON schema syntax before using --schema.

Conflicting Options

Exception: Can't use --system with other args

Solution: Use --system alone, or use template options without --system.

Template Testing

Test Template Creation

# Create and test a simple template
tg-set-prompt \
  --id "test-template" \
  --prompt "Test template with  and "

# Test the template
tg-invoke-prompt test-template variable1="hello" variable2="world"

Validate JSON Templates

# Create JSON template
tg-set-prompt \
  --id "json-test" \
  --prompt "Extract data from: " \
  --response "json" \
  --schema '{"type": "object", "properties": {"result": {"type": "string"}}}'

# Test JSON response
tg-invoke-prompt json-test text="Sample text for testing"

Template Iteration

# Version 1
tg-set-prompt \
  --id "analysis-v1" \
  --prompt "Analyze: "

# Version 2 (improved)
tg-set-prompt \
  --id "analysis-v2" \
  --prompt "Analyze the following  and provide insights about :\n\n\n\nConsider: "

# Version 3 (structured)
tg-set-prompt \
  --id "analysis-v3" \
  --prompt "Analyze: " \
  --response "json" \
  --schema '{"type": "object", "properties": {"summary": {"type": "string"}, "insights": {"type": "array"}}}'

Best Practices

Template Design

# Good: Clear, specific prompts
tg-set-prompt \
  --id "good-summary" \
  --prompt "Summarize this  in  words, focusing on :\n\n

<!DOCTYPE html>

<html lang="en-US">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">

  <link rel="stylesheet" href="/assets/css/just-the-docs-default.css">

  <link rel="stylesheet" href="/assets/css/just-the-docs-head-nav.css" id="jtd-head-nav-stylesheet">

  <style id="jtd-nav-activation">
  

    .site-nav > ul.nav-list:first-child > li > a,
    .site-nav > ul.nav-list:first-child > li > ul > li > a,
    .site-nav > ul.nav-list:first-child > li > ul > li > ul > li > a,
    
    .site-nav > ul.nav-list:first-child > li > ul > li > ul > li > ul > li:not(:nth-child(28)) > a,
    .site-nav > ul.nav-list:first-child > li > ul > li > ul > li > ul > li > ul > li a {
      background-image: none;
    }

    .site-nav > ul.nav-list:not(:first-child) a,
    .site-nav li.external a {
      background-image: none;
    }

    .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(7) > ul > li:nth-child(2) > ul > li:nth-child(28) > a {
      font-weight: 600;
      text-decoration: none;
    }.site-nav > ul.nav-list:first-child > li:nth-child(1) > button svg,
    .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(7) > button svg,
    .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(7) > ul > li:nth-child(2) > button svg,
    .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(7) > ul > li:nth-child(2) > ul > li:nth-child(28) > button svg {
      transform: rotate(-90deg);
    }.site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list,
    .site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list > li.nav-list-item:nth-child(7) > ul.nav-list,
    .site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list > li.nav-list-item:nth-child(7) > ul.nav-list > li.nav-list-item:nth-child(2) > ul.nav-list,
    .site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list > li.nav-list-item:nth-child(7) > ul.nav-list > li.nav-list-item:nth-child(2) > ul.nav-list > li.nav-list-item:nth-child(28) > ul.nav-list {
      display: block;
    }
  </style>

  

  
    <script src="/assets/js/vendor/lunr.min.js"></script>
  

  <script src="/assets/js/just-the-docs.js"></script>

  <meta name="viewport" content="width=device-width, initial-scale=1">

  



  <!-- Begin Jekyll SEO tag v2.8.0 -->
<title>tg-set-mcp-tool | TrustGraph</title>
<meta name="generator" content="Jekyll v4.4.1" />
<meta property="og:title" content="tg-set-mcp-tool" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Information on the TrustGraph platform" />
<meta property="og:description" content="Information on the TrustGraph platform" />
<link rel="canonical" href="https://docs.trustgraph.ai/reference/cli/tg-set-mcp-tool.html" />
<meta property="og:url" content="https://docs.trustgraph.ai/reference/cli/tg-set-mcp-tool.html" />
<meta property="og:site_name" content="TrustGraph" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="tg-set-mcp-tool" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebPage","description":"Information on the TrustGraph platform","headline":"tg-set-mcp-tool","url":"https://docs.trustgraph.ai/reference/cli/tg-set-mcp-tool.html"}</script>
<!-- End Jekyll SEO tag -->


  

</head>

<body>
  <a class="skip-to-main" href="#main-content">Skip to main content</a>
  <svg xmlns="http://www.w3.org/2000/svg" class="d-none">
  <symbol id="svg-link" viewBox="0 0 24 24">
  <title>Link</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link">
    <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
  </svg>
</symbol>

  <symbol id="svg-menu" viewBox="0 0 24 24">
  <title>Menu</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu">
    <line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line>
  </svg>
</symbol>

  <symbol id="svg-arrow-right" viewBox="0 0 24 24">
  <title>Expand</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right">
    <polyline points="9 18 15 12 9 6"></polyline>
  </svg>
</symbol>

  <!-- Feather. MIT License: https://github.com/feathericons/feather/blob/master/LICENSE -->
<symbol id="svg-external-link" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link">
  <title id="svg-external-link-title">(external link)</title>
  <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line>
</symbol>

  
    <symbol id="svg-doc" viewBox="0 0 24 24">
  <title>Document</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file">
    <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline>
  </svg>
</symbol>

    <symbol id="svg-search" viewBox="0 0 24 24">
  <title>Search</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search">
    <circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line>
  </svg>
</symbol>

  
  
    <!-- Bootstrap Icons. MIT License: https://github.com/twbs/icons/blob/main/LICENSE.md -->
<symbol id="svg-copy" viewBox="0 0 16 16">
  <title>Copy</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16">
    <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/>
    <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
  </svg>
</symbol>
<symbol id="svg-copied" viewBox="0 0 16 16">
  <title>Copied</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard-check-fill" viewBox="0 0 16 16">
    <path d="M6.5 0A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3Zm3 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3Z"/>
    <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1A2.5 2.5 0 0 1 9.5 5h-3A2.5 2.5 0 0 1 4 2.5v-1Zm6.854 7.354-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 0 1 .708-.708L7.5 10.793l2.646-2.647a.5.5 0 0 1 .708.708Z"/>
  </svg>
</symbol>

  
</svg>

  
    <div class="side-bar">
  <div class="site-header" role="banner">
    <a href="/" class="site-title lh-tight">
  TrustGraph

</a>
    <button id="menu-button" class="site-button btn-reset" aria-label="Toggle menu" aria-pressed="false">
      <svg viewBox="0 0 24 24" class="icon" aria-hidden="true"><use xlink:href="#svg-menu"></use></svg>
    </button>
  </div>

  <nav aria-label="Main" id="site-nav" class="site-nav">
  
  
    <ul class="nav-list"><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in TrustGraph Documentation category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/" class="nav-list-link">TrustGraph Documentation</a><ul class="nav-list"><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Getting Started category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/getting-started/" class="nav-list-link">Getting Started</a><ul class="nav-list"><li class="nav-list-item"><a href="/getting-started/concepts.html" class="nav-list-link">Core Concepts</a></li><li class="nav-list-item"><a href="/getting-started/installation.html" class="nav-list-link">Installation</a></li><li class="nav-list-item"><a href="/getting-started/first-steps.html" class="nav-list-link">First Steps</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Overview category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/overview/" class="nav-list-link">Overview</a><ul class="nav-list"><li class="nav-list-item"><a href="/overview/philosophy.html" class="nav-list-link">Philosophy</a></li><li class="nav-list-item"><a href="/overview/architecture.html" class="nav-list-link">Architecture</a></li><li class="nav-list-item"><a href="/overview/features.html" class="nav-list-link">Features</a></li><li class="nav-list-item"><a href="/overview/use-cases.html" class="nav-list-link">Use Cases</a></li><li class="nav-list-item"><a href="/overview/feature-maturity.html" class="nav-list-link">Feature Maturity</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Deployment category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/deployment/" class="nav-list-link">Deployment</a><ul class="nav-list"><li class="nav-list-item"><a href="/deployment/docker-compose.html" class="nav-list-link">Docker Compose / Podman Compose</a></li><li class="nav-list-item"><a href="/deployment/minikube.html" class="nav-list-link">Minikube</a></li><li class="nav-list-item"><a href="/deployment/intel.html" class="nav-list-link">Intel GPU / Tiber Cloud</a></li><li class="nav-list-item"><a href="/deployment/scaleway.html" class="nav-list-link">Scaleway</a></li><li class="nav-list-item"><a href="/deployment/ovhcloud.html" class="nav-list-link">OVHcloud</a></li><li class="nav-list-item"><a href="/deployment/azure.html" class="nav-list-link">Azure AKS</a></li><li class="nav-list-item"><a href="/deployment/gcp.html" class="nav-list-link">Google Cloud Platform</a></li><li class="nav-list-item"><a href="/deployment/aws-ec2.html" class="nav-list-link">AWS EC2 Single Instance</a></li><li class="nav-list-item"><a href="/deployment/aws-rke.html" class="nav-list-link">Amazon Web Services (RKE)</a></li><li class="nav-list-item"><a href="/deployment/security-considerations.html" class="nav-list-link">Security Considerations</a></li><li class="nav-list-item"><a href="/deployment/production-considerations.html" class="nav-list-link">Production Considerations</a></li><li class="nav-list-item"><a href="/deployment/troubleshooting.html" class="nav-list-link">Troubleshooting</a></li></ul></li><li class="nav-list-item"><a href="/maturity.html" class="nav-list-link">Maturity</a></li><li class="nav-list-item"><a href="/benchmarks.html" class="nav-list-link">Benchmarks</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in How-to Guides category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/guides/" class="nav-list-link">How-to Guides</a><ul class="nav-list"><li class="nav-list-item"><a href="/guides/data-integration/" class="nav-list-link">Data Integration</a></li><li class="nav-list-item"><a href="/guides/mcp-integration/" class="nav-list-link">MCP Integration</a></li><li class="nav-list-item"><a href="/guides/migration/" class="nav-list-link">Migration</a></li><li class="nav-list-item"><a href="/guides/monitoring/" class="nav-list-link">Monitoring</a></li><li class="nav-list-item"><a href="/guides/querying/" class="nav-list-link">Querying</a></li><li class="nav-list-item"><a href="/guides/security/" class="nav-list-link">Security</a></li><li class="nav-list-item"><a href="/guides/structured-processing/" class="nav-list-link">Structured data processing</a></li><li class="nav-list-item"><a href="/guides/visualization/" class="nav-list-link">Visualization</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Reference category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/reference/" class="nav-list-link">Reference</a><ul class="nav-list"><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in APIs category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/reference/apis/" class="nav-list-link">APIs</a><ul class="nav-list"><li class="nav-list-item"><a href="/reference/apis/pulsar.html" class="nav-list-link">About Pulsar</a></li><li class="nav-list-item"><a href="/reference/apis/api-agent.html" class="nav-list-link">Agent API</a></li><li class="nav-list-item"><a href="/reference/apis/api-config.html" class="nav-list-link">Config API</a></li><li class="nav-list-item"><a href="/reference/apis/api-core-import-export.html" class="nav-list-link">Core Import/Export API</a></li><li class="nav-list-item"><a href="/reference/apis/api-document-embeddings.html" class="nav-list-link">Document Embeddings API</a></li><li class="nav-list-item"><a href="/reference/apis/api-document-load.html" class="nav-list-link">Document Load API</a></li><li class="nav-list-item"><a href="/reference/apis/api-document-rag.html" class="nav-list-link">Document RAG API</a></li><li class="nav-list-item"><a href="/reference/apis/api-embeddings.html" class="nav-list-link">Embeddings API</a></li><li class="nav-list-item"><a href="/reference/apis/api-entity-contexts.html" class="nav-list-link">Entity Contexts API</a></li><li class="nav-list-item"><a href="/reference/apis/api-flow.html" class="nav-list-link">Flow API</a></li><li class="nav-list-item"><a href="/reference/apis/api-graph-embeddings.html" class="nav-list-link">Graph Embeddings API</a></li><li class="nav-list-item"><a href="/reference/apis/api-graph-rag.html" class="nav-list-link">Graph RAG API</a></li><li class="nav-list-item"><a href="/reference/apis/api-knowledge.html" class="nav-list-link">Knowledge API</a></li><li class="nav-list-item"><a href="/reference/apis/api-librarian.html" class="nav-list-link">Librarian API</a></li><li class="nav-list-item"><a href="/reference/apis/api-metrics.html" class="nav-list-link">Metrics API</a></li><li class="nav-list-item"><a href="/reference/apis/api-prompt.html" class="nav-list-link">Prompt API</a></li><li class="nav-list-item"><a href="/reference/apis/api-text-completion.html" class="nav-list-link">Text Completion API</a></li><li class="nav-list-item"><a href="/reference/apis/api-text-load.html" class="nav-list-link">Text Load API</a></li><li class="nav-list-item"><a href="/reference/apis/api-triples-query.html" class="nav-list-link">Triples Query API</a></li><li class="nav-list-item"><a href="/reference/apis/websocket.html" class="nav-list-link">websocket</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in CLI category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/reference/cli/" class="nav-list-link">CLI</a><ul class="nav-list"><li class="nav-list-item"><a href="/reference/cli/tg-add-library-document.html" class="nav-list-link">tg-add-library-document</a></li><li class="nav-list-item"><a href="/reference/cli/tg-delete-flow-class.html" class="nav-list-link">tg-delete-flow-class</a></li><li class="nav-list-item"><a href="/reference/cli/tg-delete-kg-core.html" class="nav-list-link">tg-delete-kg-core</a></li><li class="nav-list-item"><a href="/reference/cli/tg-delete-mcp-tool.html" class="nav-list-link">tg-delete-mcp-tool</a></li><li class="nav-list-item"><a href="/reference/cli/tg-delete-tool.html" class="nav-list-link">tg-delete-tool</a></li><li class="nav-list-item"><a href="/reference/cli/tg-dump-msgpack.html" class="nav-list-link">tg-dump-msgpack</a></li><li class="nav-list-item"><a href="/reference/cli/tg-get-flow-class.html" class="nav-list-link">tg-get-flow-class</a></li><li class="nav-list-item"><a href="/reference/cli/tg-get-kg-core.html" class="nav-list-link">tg-get-kg-core</a></li><li class="nav-list-item"><a href="/reference/cli/tg-graph-to-turtle.html" class="nav-list-link">tg-graph-to-turtle</a></li><li class="nav-list-item"><a href="/reference/cli/tg-init-pulsar-manager.html" class="nav-list-link">tg-init-pulsar-manager</a></li><li class="nav-list-item"><a href="/reference/cli/tg-init-trustgraph.html" class="nav-list-link">tg-init-trustgraph</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-agent.html" class="nav-list-link">tg-invoke-agent</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-document-rag.html" class="nav-list-link">tg-invoke-document-rag</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-graph-rag.html" class="nav-list-link">tg-invoke-graph-rag</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-llm.html" class="nav-list-link">tg-invoke-llm</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-mcp-tool.html" class="nav-list-link">tg-invoke-mcp-tool</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-prompt.html" class="nav-list-link">tg-invoke-prompt</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-doc-embeds.html" class="nav-list-link">tg-load-doc-embeds</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-kg-core.html" class="nav-list-link">tg-load-kg-core</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-knowledge.html" class="nav-list-link">tg-load-knowledge</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-pdf.html" class="nav-list-link">tg-load-pdf</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-sample-documents.html" class="nav-list-link">tg-load-sample-documents</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-text.html" class="nav-list-link">tg-load-text</a></li><li class="nav-list-item"><a href="/reference/cli/tg-put-flow-class.html" class="nav-list-link">tg-put-flow-class</a></li><li class="nav-list-item"><a href="/reference/cli/tg-put-kg-core.html" class="nav-list-link">tg-put-kg-core</a></li><li class="nav-list-item"><a href="/reference/cli/tg-remove-library-document.html" class="nav-list-link">tg-remove-library-document</a></li><li class="nav-list-item"><a href="/reference/cli/tg-save-doc-embeds.html" class="nav-list-link">tg-save-doc-embeds</a></li><li class="nav-list-item"><a href="/reference/cli/tg-set-mcp-tool.html" class="nav-list-link">tg-set-mcp-tool</a></li><li class="nav-list-item"><a href="/reference/cli/tg-set-prompt.html" class="nav-list-link">tg-set-prompt</a></li><li class="nav-list-item"><a href="/reference/cli/tg-set-token-costs.html" class="nav-list-link">tg-set-token-costs</a></li><li class="nav-list-item"><a href="/reference/cli/tg-set-tool.html" class="nav-list-link">tg-set-tool</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-config.html" class="nav-list-link">tg-show-config</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-flow-classes.html" class="nav-list-link">tg-show-flow-classes</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-flow-state.html" class="nav-list-link">tg-show-flow-state</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-flows.html" class="nav-list-link">tg-show-flows</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-graph.html" class="nav-list-link">tg-show-graph</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-kg-cores.html" class="nav-list-link">tg-show-kg-cores</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-library-documents.html" class="nav-list-link">tg-show-library-documents</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-library-processing.html" class="nav-list-link">tg-show-library-processing</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-mcp-tools.html" class="nav-list-link">tg-show-mcp-tools</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-processor-state.html" class="nav-list-link">tg-show-processor-state</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-prompts.html" class="nav-list-link">tg-show-prompts</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-token-costs.html" class="nav-list-link">tg-show-token-costs</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-token-rate.html" class="nav-list-link">tg-show-token-rate</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-tools.html" class="nav-list-link">tg-show-tools</a></li><li class="nav-list-item"><a href="/reference/cli/tg-start-flow.html" class="nav-list-link">tg-start-flow</a></li><li class="nav-list-item"><a href="/reference/cli/tg-start-library-processing.html" class="nav-list-link">tg-start-library-processing</a></li><li class="nav-list-item"><a href="/reference/cli/tg-stop-flow.html" class="nav-list-link">tg-stop-flow</a></li><li class="nav-list-item"><a href="/reference/cli/tg-stop-library-processing.html" class="nav-list-link">tg-stop-library-processing</a></li><li class="nav-list-item"><a href="/reference/cli/tg-unload-kg-core.html" class="nav-list-link">tg-unload-kg-core</a></li></ul></li><li class="nav-list-item"><a href="/reference/containers.html" class="nav-list-link">Containers</a></li><li class="nav-list-item"><a href="/reference/python-packages.html" class="nav-list-link">Python packages</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Extending TrustGraph category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/reference/extending/" class="nav-list-link">Extending TrustGraph</a><ul class="nav-list"><li class="nav-list-item"><a href="/reference/extending/async-processor.html" class="nav-list-link">AsyncProcessor</a></li><li class="nav-list-item"><a href="/reference/extending/flow-processor.html" class="nav-list-link">FlowProcessor</a></li><li class="nav-list-item"><a href="/reference/extending/service-base-classes.html" class="nav-list-link">Service Base Classes</a></li><li class="nav-list-item"><a href="/reference/extending/flow-specifications.html" class="nav-list-link">Flow Specifications</a></li></ul></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Community category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/community/" class="nav-list-link">Community</a><ul class="nav-list"><li class="nav-list-item"><a href="/community/changelog/trustgraph.html" class="nav-list-link">Changelog - TrustGraph</a></li><li class="nav-list-item"><a href="/community/changelog/workbench.html" class="nav-list-link">Changelog - Workbench</a></li><li class="nav-list-item"><a href="/community/code-of-conduct.html" class="nav-list-link">Code of Conduct</a></li><li class="nav-list-item"><a href="/community/contributing.html" class="nav-list-link">Contributing</a></li><li class="nav-list-item"><a href="/community/developer.html" class="nav-list-link">Developer's Guide</a></li><li class="nav-list-item"><a href="/community/roadmap.html" class="nav-list-link">Roadmap</a></li><li class="nav-list-item"><a href="/community/support.html" class="nav-list-link">Support</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Examples category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/examples/" class="nav-list-link">Examples</a><ul class="nav-list"><li class="nav-list-item"><a href="/examples/integrations/" class="nav-list-link">Integrations</a></li><li class="nav-list-item"><a href="/examples/sample-data/" class="nav-list-link">Sample Data</a></li><li class="nav-list-item"><a href="/examples/tutorials/" class="nav-list-link">Tutorials</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Advanced Topics category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/advanced/" class="nav-list-link">Advanced Topics</a><ul class="nav-list"><li class="nav-list-item"><a href="/advanced/backup-restore.html" class="nav-list-link">Backup & Restore</a></li><li class="nav-list-item"><a href="/advanced/clustering.html" class="nav-list-link">Clustering</a></li><li class="nav-list-item"><a href="/advanced/custom-algorithms.html" class="nav-list-link">Custom Algorithms</a></li><li class="nav-list-item"><a href="/advanced/disaster-recovery.html" class="nav-list-link">Disaster Recovery</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Extending TrustGraph category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/advanced/extending-trustgraph.html" class="nav-list-link">Extending TrustGraph</a><ul class="nav-list"><li class="nav-list-item"><a href="/reference/extending/async-processor.html" class="nav-list-link">AsyncProcessor</a></li><li class="nav-list-item"><a href="/reference/extending/flow-processor.html" class="nav-list-link">FlowProcessor</a></li><li class="nav-list-item"><a href="/reference/extending/service-base-classes.html" class="nav-list-link">Service Base Classes</a></li><li class="nav-list-item"><a href="/reference/extending/flow-specifications.html" class="nav-list-link">Flow Specifications</a></li></ul></li><li class="nav-list-item"><a href="/advanced/performance-tuning.html" class="nav-list-link">Performance Tuning</a></li></ul></li></ul></li></ul>
  
</nav>




  
  
    <footer class="site-footer">
      This site uses <a href="https://github.com/just-the-docs/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.
    </footer>
  
</div>

  
  <div class="main" id="top">
    <div id="main-header" class="main-header">
  
    

<div class="search" role="search">
  <div class="search-input-wrap">
    <input type="text" id="search-input" class="search-input" tabindex="0" placeholder="Search TrustGraph" aria-label="Search TrustGraph" autocomplete="off">
    <label for="search-input" class="search-label"><svg viewBox="0 0 24 24" class="search-icon"><use xlink:href="#svg-search"></use></svg></label>
  </div>
  <div id="search-results" class="search-results"></div>
</div>

  
  
  
    <nav aria-label="Auxiliary" class="aux-nav">
  <ul class="aux-nav-list">
    
      <li class="aux-nav-list-item">
        <a href="//github.com/trustgraph-ai/trustgraph" class="site-button"
          
          target="_blank" rel="noopener noreferrer"
          
        >
          TrustGraph on GitHub
        </a>
      </li>
    
  </ul>
</nav>

  
</div>

    <div class="main-content-wrap">
      <nav aria-label="Breadcrumb" class="breadcrumb-nav">
  <ol class="breadcrumb-nav-list">
    <li class="breadcrumb-nav-list-item"><a href="/">TrustGraph Documentation</a></li>
    <li class="breadcrumb-nav-list-item"><a href="/reference/">Reference</a></li>
    <li class="breadcrumb-nav-list-item"><a href="/reference/cli/">CLI</a></li>
    <li class="breadcrumb-nav-list-item"><span>tg-set-mcp-tool</span></li>
  </ol>
</nav>


      <div id="main-content" class="main-content">
        <main>
          
            <h1 id="tg-set-mcp-tool">
  
  
    <a href="#tg-set-mcp-tool" class="anchor-heading" aria-labelledby="tg-set-mcp-tool"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> tg-set-mcp-tool
  
  
</h1>
    
<h2 id="synopsis">
  
  
    <a href="#synopsis" class="anchor-heading" aria-labelledby="synopsis"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Synopsis
  
  
</h2>
    

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tg-set-mcp-tool [OPTIONS] --id ID --tool-url URL
</code></pre></div></div>
<h2 id="description">
  
  
    <a href="#description" class="anchor-heading" aria-labelledby="description"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Description
  
  
</h2>
    

<p>The <code class="language-plaintext highlighter-rouge">tg-set-mcp-tool</code> command configures and registers MCP (Model Context Protocol) tools in the TrustGraph system. MCP tools are external services that follow the Model Context Protocol specification and can be integrated with TrustGraph agents.</p>

<p>This command stores MCP tool configurations in the ‘mcp’ configuration group with:</p>
<ul>
  <li><strong>id</strong>: Unique identifier for the tool</li>
  <li><strong>remote-name</strong>: Name used by the MCP server (defaults to id if not specified)</li>
  <li><strong>url</strong>: MCP server endpoint URL</li>
</ul>

<p>Once configured, MCP tools can be referenced by agent tools using the ‘mcp-tool’ type via the <code class="language-plaintext highlighter-rouge">tg-set-tool</code> command.</p>
<h2 id="options">
  
  
    <a href="#options" class="anchor-heading" aria-labelledby="options"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Options
  
  
</h2>
    

<ul>
  <li><code class="language-plaintext highlighter-rouge">-u, --api-url URL</code>
    <ul>
      <li>TrustGraph API URL to connect to</li>
      <li>Default: <code class="language-plaintext highlighter-rouge">http://localhost:8088/</code> (or <code class="language-plaintext highlighter-rouge">TRUSTGRAPH_URL</code> environment variable)</li>
      <li>Should point to a running TrustGraph API instance</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">-i, --id ID</code>
    <ul>
      <li><strong>Required</strong>: Unique identifier for the MCP tool</li>
      <li>Used to reference the tool in agent configurations</li>
      <li>Must be unique within the MCP tool namespace</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">-r, --remote-name NAME</code>
    <ul>
      <li>Optional: Name used by the MCP server</li>
      <li>Defaults to the value of <code class="language-plaintext highlighter-rouge">--id</code> if not specified</li>
      <li>Useful when the MCP server expects a different name than the local identifier</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">--tool-url URL</code>
    <ul>
      <li><strong>Required</strong>: MCP server endpoint URL</li>
      <li>Should point to a running MCP server that implements the Model Context Protocol</li>
      <li>Must be a valid HTTP/HTTPS URL</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">-h, --help</code>
    <ul>
      <li>Show help message and exit</li>
    </ul>
  </li>
</ul>
<h2 id="examples">
  
  
    <a href="#examples" class="anchor-heading" aria-labelledby="examples"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Examples
  
  
</h2>
    
<h3 id="basic-mcp-tool-configuration">
  
  
    <a href="#basic-mcp-tool-configuration" class="anchor-heading" aria-labelledby="basic-mcp-tool-configuration"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Basic MCP Tool Configuration
  
  
</h3>
    

<p>Register a weather MCP tool:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tg-set-mcp-tool <span class="nt">--id</span> weather <span class="nt">--tool-url</span> <span class="s2">"http://localhost:3000/weather"</span>
</code></pre></div></div>
<h3 id="mcp-tool-with-custom-remote-name">
  
  
    <a href="#mcp-tool-with-custom-remote-name" class="anchor-heading" aria-labelledby="mcp-tool-with-custom-remote-name"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> MCP Tool with Custom Remote Name
  
  
</h3>
    

<p>Register a calculator tool with a different remote name:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tg-set-mcp-tool <span class="nt">--id</span> calculator <span class="nt">--remote-name</span> calc-service <span class="nt">--tool-url</span> <span class="s2">"http://mcp-tools.example.com/calc"</span>
</code></pre></div></div>
<h3 id="custom-api-url">
  
  
    <a href="#custom-api-url" class="anchor-heading" aria-labelledby="custom-api-url"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Custom API URL
  
  
</h3>
    

<p>Configure MCP tool on a specific TrustGraph instance:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tg-set-mcp-tool <span class="nt">-u</span> http://trustgraph.example.com:8088/ <span class="se">\</span>
  <span class="nt">--id</span> file-reader <span class="nt">--tool-url</span> <span class="s2">"http://localhost:4000/files"</span>
</code></pre></div></div>
<h3 id="remote-mcp-server">
  
  
    <a href="#remote-mcp-server" class="anchor-heading" aria-labelledby="remote-mcp-server"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Remote MCP Server
  
  
</h3>
    

<p>Configure tool pointing to a remote MCP server:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tg-set-mcp-tool <span class="nt">--id</span> search-engine <span class="se">\</span>
  <span class="nt">--tool-url</span> <span class="s2">"https://mcp-services.example.com/search"</span> <span class="se">\</span>
  <span class="nt">--remote-name</span> web-search
</code></pre></div></div>
<h2 id="integration-with-agent-tools">
  
  
    <a href="#integration-with-agent-tools" class="anchor-heading" aria-labelledby="integration-with-agent-tools"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Integration with Agent Tools
  
  
</h2>
    

<p>After configuring an MCP tool, it can be used by agents through the <code class="language-plaintext highlighter-rouge">tg-set-tool</code> command:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># First, configure the MCP tool</span>
tg-set-mcp-tool <span class="nt">--id</span> weather <span class="nt">--tool-url</span> <span class="s2">"http://localhost:3000/weather"</span>

<span class="c"># Then, create an agent tool that uses the MCP tool</span>
tg-set-tool <span class="nt">--id</span> weather-lookup <span class="nt">--name</span> <span class="s2">"Weather Lookup"</span> <span class="se">\</span>
  <span class="nt">--type</span> mcp-tool <span class="nt">--mcp-tool</span> weather <span class="se">\</span>
  <span class="nt">--description</span> <span class="s2">"Get weather information for a location"</span> <span class="se">\</span>
  <span class="nt">--argument</span> location:string:<span class="s2">"Location to query"</span> <span class="se">\</span>
  <span class="nt">--argument</span> units:string:<span class="s2">"Temperature units (C/F)"</span>
</code></pre></div></div>
<h2 id="configuration-storage">
  
  
    <a href="#configuration-storage" class="anchor-heading" aria-labelledby="configuration-storage"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Configuration Storage
  
  
</h2>
    

<p>MCP tool configurations are stored in the TrustGraph configuration system under the ‘mcp’ type with the following JSON structure:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"remote-name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"weather-service"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/weather"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<h2 id="mcp-protocol-requirements">
  
  
    <a href="#mcp-protocol-requirements" class="anchor-heading" aria-labelledby="mcp-protocol-requirements"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> MCP Protocol Requirements
  
  
</h2>
    

<p>The MCP tool URL should point to a server that implements the Model Context Protocol specification. The server should:</p>

<ol>
  <li>Accept HTTP POST requests with MCP-compliant message format</li>
  <li>Return responses in the expected MCP format</li>
  <li>Handle authentication and authorization as needed</li>
  <li>Provide proper error handling and status codes</li>
</ol>
<h2 id="error-handling">
  
  
    <a href="#error-handling" class="anchor-heading" aria-labelledby="error-handling"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Error Handling
  
  
</h2>
    

<p>The command handles various error conditions:</p>

<ul>
  <li><strong>Invalid URL format</strong>: If the tool URL is malformed</li>
  <li><strong>API connection errors</strong>: If the TrustGraph API is unavailable</li>
  <li><strong>Authentication errors</strong>: If API access is denied</li>
  <li><strong>Configuration errors</strong>: If the tool configuration cannot be stored</li>
</ul>

<p>Common error scenarios:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Invalid tool URL</span>
tg-set-mcp-tool <span class="nt">--id</span> <span class="nb">test</span> <span class="nt">--tool-url</span> <span class="s2">"not-a-valid-url"</span>
<span class="c"># Output: Exception: [URL validation error]</span>

<span class="c"># API not available</span>
tg-set-mcp-tool <span class="nt">--id</span> <span class="nb">test</span> <span class="nt">--tool-url</span> <span class="s2">"http://localhost:3000"</span> <span class="nt">-u</span> http://invalid-host:8088/
<span class="c"># Output: Exception: [Connection error details]</span>

<span class="c"># Missing required arguments</span>
tg-set-mcp-tool <span class="nt">--id</span> <span class="nb">test</span>
<span class="c"># Output: Exception: Must specify --tool-url for MCP tool</span>
</code></pre></div></div>
<h2 id="verification">
  
  
    <a href="#verification" class="anchor-heading" aria-labelledby="verification"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Verification
  
  
</h2>
    

<p>After configuring an MCP tool, verify it was stored correctly:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># List all MCP tools</span>
tg-show-mcp-tools

<span class="c"># Check if specific tool exists</span>
tg-show-mcp-tools | <span class="nb">grep</span> <span class="nt">-A</span> 5 <span class="s2">"weather"</span>
</code></pre></div></div>
<h2 id="best-practices">
  
  
    <a href="#best-practices" class="anchor-heading" aria-labelledby="best-practices"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Best Practices
  
  
</h2>
    

<ol>
  <li><strong>Use descriptive IDs</strong>: Choose clear, descriptive identifiers for MCP tools</li>
  <li><strong>Test connectivity</strong>: Verify the MCP server is accessible before configuration</li>
  <li><strong>Document tools</strong>: Keep track of MCP tool purposes and configurations</li>
  <li><strong>Monitor health</strong>: Regularly check that MCP servers are responding correctly</li>
  <li><strong>Version control</strong>: Track MCP tool configuration changes</li>
</ol>
<h2 id="security-considerations">
  
  
    <a href="#security-considerations" class="anchor-heading" aria-labelledby="security-considerations"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Security Considerations
  
  
</h2>
    

<ul>
  <li>Ensure MCP server URLs use HTTPS in production environments</li>
  <li>Validate that MCP servers implement proper authentication</li>
  <li>Review MCP tool permissions and capabilities</li>
  <li>Monitor MCP tool usage and access patterns</li>
</ul>
<h2 id="related-commands">
  
  
    <a href="#related-commands" class="anchor-heading" aria-labelledby="related-commands"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Related Commands
  
  
</h2>
    

<ul>
  <li><a href="tg-show-mcp-tools"><code class="language-plaintext highlighter-rouge">tg-show-mcp-tools</code></a> - Display configured MCP tools</li>
  <li><a href="tg-delete-mcp-tool"><code class="language-plaintext highlighter-rouge">tg-delete-mcp-tool</code></a> - Remove MCP tool configuration</li>
  <li><a href="tg-invoke-mcp-tool"><code class="language-plaintext highlighter-rouge">tg-invoke-mcp-tool</code></a> - Test MCP tool functionality</li>
  <li><a href="tg-set-tool"><code class="language-plaintext highlighter-rouge">tg-set-tool</code></a> - Configure agent tools that use MCP tools</li>
  <li><a href="tg-show-tools"><code class="language-plaintext highlighter-rouge">tg-show-tools</code></a> - Display all agent tools</li>
</ul>
<h2 id="see-also">
  
  
    <a href="#see-also" class="anchor-heading" aria-labelledby="see-also"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> See Also
  
  
</h2>
    

<ul>
  <li>Model Context Protocol Specification</li>
  <li>TrustGraph Agent Tool Configuration</li>
  <li>MCP Integration Guide</li>
</ul>

          

          
            
          
        </main>
        

  <hr>
  <footer>
    

    <p class="text-small text-grey-dk-100 mb-0">Copyright &copy; 2024-2025 TrustGraph.ai. Distributed under an <a href="https://github.com/trustgraph-ai/trustgraph/blob/master/LICENSE">Apache 2 license.</a></p>

    
      <div class="d-flex mt-2">
        
        
          <p class="text-small text-grey-dk-000 mb-0">
            <a href="https://github.com/trustgraph-ai/trustgraph-ai.github.io/tree/main/reference/cli/tg-set-mcp-tool.md" id="edit-this-page">Edit this page on GitHub.</a>
          </p>
        
      </div>
    
  </footer>


      </div>
    </div>
    
      

<div class="search-overlay"></div>

    
  </div>

  
    






  <script src="https://cdn.jsdelivr.net/npm/mermaid@9.1.3/dist/mermaid.min.js"></script>


<script>
  var config = {}
;
  mermaid.initialize(config);
  window.mermaid.init(undefined, document.querySelectorAll('.language-mermaid'));
</script>



  
</body>
</html>

"

# Better: Include context and constraints
tg-set-prompt \
  --id "better-summary" \
  --prompt "Task: Summarize the following 
Length:  words maximum
Focus: 
Audience: 

Document:


<!DOCTYPE html>

<html lang="en-US">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">

  <link rel="stylesheet" href="/assets/css/just-the-docs-default.css">

  <link rel="stylesheet" href="/assets/css/just-the-docs-head-nav.css" id="jtd-head-nav-stylesheet">

  <style id="jtd-nav-activation">
  

    .site-nav > ul.nav-list:first-child > li > a,
    .site-nav > ul.nav-list:first-child > li > ul > li > a,
    .site-nav > ul.nav-list:first-child > li > ul > li > ul > li > a,
    
    .site-nav > ul.nav-list:first-child > li > ul > li > ul > li > ul > li:not(:nth-child(28)) > a,
    .site-nav > ul.nav-list:first-child > li > ul > li > ul > li > ul > li > ul > li a {
      background-image: none;
    }

    .site-nav > ul.nav-list:not(:first-child) a,
    .site-nav li.external a {
      background-image: none;
    }

    .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(7) > ul > li:nth-child(2) > ul > li:nth-child(28) > a {
      font-weight: 600;
      text-decoration: none;
    }.site-nav > ul.nav-list:first-child > li:nth-child(1) > button svg,
    .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(7) > button svg,
    .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(7) > ul > li:nth-child(2) > button svg,
    .site-nav > ul.nav-list:first-child > li:nth-child(1) > ul > li:nth-child(7) > ul > li:nth-child(2) > ul > li:nth-child(28) > button svg {
      transform: rotate(-90deg);
    }.site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list,
    .site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list > li.nav-list-item:nth-child(7) > ul.nav-list,
    .site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list > li.nav-list-item:nth-child(7) > ul.nav-list > li.nav-list-item:nth-child(2) > ul.nav-list,
    .site-nav > ul.nav-list:first-child > li.nav-list-item:nth-child(1) > ul.nav-list > li.nav-list-item:nth-child(7) > ul.nav-list > li.nav-list-item:nth-child(2) > ul.nav-list > li.nav-list-item:nth-child(28) > ul.nav-list {
      display: block;
    }
  </style>

  

  
    <script src="/assets/js/vendor/lunr.min.js"></script>
  

  <script src="/assets/js/just-the-docs.js"></script>

  <meta name="viewport" content="width=device-width, initial-scale=1">

  



  <!-- Begin Jekyll SEO tag v2.8.0 -->
<title>tg-set-mcp-tool | TrustGraph</title>
<meta name="generator" content="Jekyll v4.4.1" />
<meta property="og:title" content="tg-set-mcp-tool" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Information on the TrustGraph platform" />
<meta property="og:description" content="Information on the TrustGraph platform" />
<link rel="canonical" href="https://docs.trustgraph.ai/reference/cli/tg-set-mcp-tool.html" />
<meta property="og:url" content="https://docs.trustgraph.ai/reference/cli/tg-set-mcp-tool.html" />
<meta property="og:site_name" content="TrustGraph" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="tg-set-mcp-tool" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"WebPage","description":"Information on the TrustGraph platform","headline":"tg-set-mcp-tool","url":"https://docs.trustgraph.ai/reference/cli/tg-set-mcp-tool.html"}</script>
<!-- End Jekyll SEO tag -->


  

</head>

<body>
  <a class="skip-to-main" href="#main-content">Skip to main content</a>
  <svg xmlns="http://www.w3.org/2000/svg" class="d-none">
  <symbol id="svg-link" viewBox="0 0 24 24">
  <title>Link</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link">
    <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
  </svg>
</symbol>

  <symbol id="svg-menu" viewBox="0 0 24 24">
  <title>Menu</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu">
    <line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line>
  </svg>
</symbol>

  <symbol id="svg-arrow-right" viewBox="0 0 24 24">
  <title>Expand</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right">
    <polyline points="9 18 15 12 9 6"></polyline>
  </svg>
</symbol>

  <!-- Feather. MIT License: https://github.com/feathericons/feather/blob/master/LICENSE -->
<symbol id="svg-external-link" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link">
  <title id="svg-external-link-title">(external link)</title>
  <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line>
</symbol>

  
    <symbol id="svg-doc" viewBox="0 0 24 24">
  <title>Document</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file">
    <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline>
  </svg>
</symbol>

    <symbol id="svg-search" viewBox="0 0 24 24">
  <title>Search</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search">
    <circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line>
  </svg>
</symbol>

  
  
    <!-- Bootstrap Icons. MIT License: https://github.com/twbs/icons/blob/main/LICENSE.md -->
<symbol id="svg-copy" viewBox="0 0 16 16">
  <title>Copy</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16">
    <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/>
    <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
  </svg>
</symbol>
<symbol id="svg-copied" viewBox="0 0 16 16">
  <title>Copied</title>
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard-check-fill" viewBox="0 0 16 16">
    <path d="M6.5 0A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3Zm3 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3Z"/>
    <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1A2.5 2.5 0 0 1 9.5 5h-3A2.5 2.5 0 0 1 4 2.5v-1Zm6.854 7.354-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 0 1 .708-.708L7.5 10.793l2.646-2.647a.5.5 0 0 1 .708.708Z"/>
  </svg>
</symbol>

  
</svg>

  
    <div class="side-bar">
  <div class="site-header" role="banner">
    <a href="/" class="site-title lh-tight">
  TrustGraph

</a>
    <button id="menu-button" class="site-button btn-reset" aria-label="Toggle menu" aria-pressed="false">
      <svg viewBox="0 0 24 24" class="icon" aria-hidden="true"><use xlink:href="#svg-menu"></use></svg>
    </button>
  </div>

  <nav aria-label="Main" id="site-nav" class="site-nav">
  
  
    <ul class="nav-list"><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in TrustGraph Documentation category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/" class="nav-list-link">TrustGraph Documentation</a><ul class="nav-list"><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Getting Started category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/getting-started/" class="nav-list-link">Getting Started</a><ul class="nav-list"><li class="nav-list-item"><a href="/getting-started/concepts.html" class="nav-list-link">Core Concepts</a></li><li class="nav-list-item"><a href="/getting-started/installation.html" class="nav-list-link">Installation</a></li><li class="nav-list-item"><a href="/getting-started/first-steps.html" class="nav-list-link">First Steps</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Overview category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/overview/" class="nav-list-link">Overview</a><ul class="nav-list"><li class="nav-list-item"><a href="/overview/philosophy.html" class="nav-list-link">Philosophy</a></li><li class="nav-list-item"><a href="/overview/architecture.html" class="nav-list-link">Architecture</a></li><li class="nav-list-item"><a href="/overview/features.html" class="nav-list-link">Features</a></li><li class="nav-list-item"><a href="/overview/use-cases.html" class="nav-list-link">Use Cases</a></li><li class="nav-list-item"><a href="/overview/feature-maturity.html" class="nav-list-link">Feature Maturity</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Deployment category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/deployment/" class="nav-list-link">Deployment</a><ul class="nav-list"><li class="nav-list-item"><a href="/deployment/docker-compose.html" class="nav-list-link">Docker Compose / Podman Compose</a></li><li class="nav-list-item"><a href="/deployment/minikube.html" class="nav-list-link">Minikube</a></li><li class="nav-list-item"><a href="/deployment/intel.html" class="nav-list-link">Intel GPU / Tiber Cloud</a></li><li class="nav-list-item"><a href="/deployment/scaleway.html" class="nav-list-link">Scaleway</a></li><li class="nav-list-item"><a href="/deployment/ovhcloud.html" class="nav-list-link">OVHcloud</a></li><li class="nav-list-item"><a href="/deployment/azure.html" class="nav-list-link">Azure AKS</a></li><li class="nav-list-item"><a href="/deployment/gcp.html" class="nav-list-link">Google Cloud Platform</a></li><li class="nav-list-item"><a href="/deployment/aws-ec2.html" class="nav-list-link">AWS EC2 Single Instance</a></li><li class="nav-list-item"><a href="/deployment/aws-rke.html" class="nav-list-link">Amazon Web Services (RKE)</a></li><li class="nav-list-item"><a href="/deployment/security-considerations.html" class="nav-list-link">Security Considerations</a></li><li class="nav-list-item"><a href="/deployment/production-considerations.html" class="nav-list-link">Production Considerations</a></li><li class="nav-list-item"><a href="/deployment/troubleshooting.html" class="nav-list-link">Troubleshooting</a></li></ul></li><li class="nav-list-item"><a href="/maturity.html" class="nav-list-link">Maturity</a></li><li class="nav-list-item"><a href="/benchmarks.html" class="nav-list-link">Benchmarks</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in How-to Guides category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/guides/" class="nav-list-link">How-to Guides</a><ul class="nav-list"><li class="nav-list-item"><a href="/guides/data-integration/" class="nav-list-link">Data Integration</a></li><li class="nav-list-item"><a href="/guides/mcp-integration/" class="nav-list-link">MCP Integration</a></li><li class="nav-list-item"><a href="/guides/migration/" class="nav-list-link">Migration</a></li><li class="nav-list-item"><a href="/guides/monitoring/" class="nav-list-link">Monitoring</a></li><li class="nav-list-item"><a href="/guides/querying/" class="nav-list-link">Querying</a></li><li class="nav-list-item"><a href="/guides/security/" class="nav-list-link">Security</a></li><li class="nav-list-item"><a href="/guides/structured-processing/" class="nav-list-link">Structured data processing</a></li><li class="nav-list-item"><a href="/guides/visualization/" class="nav-list-link">Visualization</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Reference category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/reference/" class="nav-list-link">Reference</a><ul class="nav-list"><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in APIs category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/reference/apis/" class="nav-list-link">APIs</a><ul class="nav-list"><li class="nav-list-item"><a href="/reference/apis/pulsar.html" class="nav-list-link">About Pulsar</a></li><li class="nav-list-item"><a href="/reference/apis/api-agent.html" class="nav-list-link">Agent API</a></li><li class="nav-list-item"><a href="/reference/apis/api-config.html" class="nav-list-link">Config API</a></li><li class="nav-list-item"><a href="/reference/apis/api-core-import-export.html" class="nav-list-link">Core Import/Export API</a></li><li class="nav-list-item"><a href="/reference/apis/api-document-embeddings.html" class="nav-list-link">Document Embeddings API</a></li><li class="nav-list-item"><a href="/reference/apis/api-document-load.html" class="nav-list-link">Document Load API</a></li><li class="nav-list-item"><a href="/reference/apis/api-document-rag.html" class="nav-list-link">Document RAG API</a></li><li class="nav-list-item"><a href="/reference/apis/api-embeddings.html" class="nav-list-link">Embeddings API</a></li><li class="nav-list-item"><a href="/reference/apis/api-entity-contexts.html" class="nav-list-link">Entity Contexts API</a></li><li class="nav-list-item"><a href="/reference/apis/api-flow.html" class="nav-list-link">Flow API</a></li><li class="nav-list-item"><a href="/reference/apis/api-graph-embeddings.html" class="nav-list-link">Graph Embeddings API</a></li><li class="nav-list-item"><a href="/reference/apis/api-graph-rag.html" class="nav-list-link">Graph RAG API</a></li><li class="nav-list-item"><a href="/reference/apis/api-knowledge.html" class="nav-list-link">Knowledge API</a></li><li class="nav-list-item"><a href="/reference/apis/api-librarian.html" class="nav-list-link">Librarian API</a></li><li class="nav-list-item"><a href="/reference/apis/api-metrics.html" class="nav-list-link">Metrics API</a></li><li class="nav-list-item"><a href="/reference/apis/api-prompt.html" class="nav-list-link">Prompt API</a></li><li class="nav-list-item"><a href="/reference/apis/api-text-completion.html" class="nav-list-link">Text Completion API</a></li><li class="nav-list-item"><a href="/reference/apis/api-text-load.html" class="nav-list-link">Text Load API</a></li><li class="nav-list-item"><a href="/reference/apis/api-triples-query.html" class="nav-list-link">Triples Query API</a></li><li class="nav-list-item"><a href="/reference/apis/websocket.html" class="nav-list-link">websocket</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in CLI category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/reference/cli/" class="nav-list-link">CLI</a><ul class="nav-list"><li class="nav-list-item"><a href="/reference/cli/tg-add-library-document.html" class="nav-list-link">tg-add-library-document</a></li><li class="nav-list-item"><a href="/reference/cli/tg-delete-flow-class.html" class="nav-list-link">tg-delete-flow-class</a></li><li class="nav-list-item"><a href="/reference/cli/tg-delete-kg-core.html" class="nav-list-link">tg-delete-kg-core</a></li><li class="nav-list-item"><a href="/reference/cli/tg-delete-mcp-tool.html" class="nav-list-link">tg-delete-mcp-tool</a></li><li class="nav-list-item"><a href="/reference/cli/tg-delete-tool.html" class="nav-list-link">tg-delete-tool</a></li><li class="nav-list-item"><a href="/reference/cli/tg-dump-msgpack.html" class="nav-list-link">tg-dump-msgpack</a></li><li class="nav-list-item"><a href="/reference/cli/tg-get-flow-class.html" class="nav-list-link">tg-get-flow-class</a></li><li class="nav-list-item"><a href="/reference/cli/tg-get-kg-core.html" class="nav-list-link">tg-get-kg-core</a></li><li class="nav-list-item"><a href="/reference/cli/tg-graph-to-turtle.html" class="nav-list-link">tg-graph-to-turtle</a></li><li class="nav-list-item"><a href="/reference/cli/tg-init-pulsar-manager.html" class="nav-list-link">tg-init-pulsar-manager</a></li><li class="nav-list-item"><a href="/reference/cli/tg-init-trustgraph.html" class="nav-list-link">tg-init-trustgraph</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-agent.html" class="nav-list-link">tg-invoke-agent</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-document-rag.html" class="nav-list-link">tg-invoke-document-rag</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-graph-rag.html" class="nav-list-link">tg-invoke-graph-rag</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-llm.html" class="nav-list-link">tg-invoke-llm</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-mcp-tool.html" class="nav-list-link">tg-invoke-mcp-tool</a></li><li class="nav-list-item"><a href="/reference/cli/tg-invoke-prompt.html" class="nav-list-link">tg-invoke-prompt</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-doc-embeds.html" class="nav-list-link">tg-load-doc-embeds</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-kg-core.html" class="nav-list-link">tg-load-kg-core</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-knowledge.html" class="nav-list-link">tg-load-knowledge</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-pdf.html" class="nav-list-link">tg-load-pdf</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-sample-documents.html" class="nav-list-link">tg-load-sample-documents</a></li><li class="nav-list-item"><a href="/reference/cli/tg-load-text.html" class="nav-list-link">tg-load-text</a></li><li class="nav-list-item"><a href="/reference/cli/tg-put-flow-class.html" class="nav-list-link">tg-put-flow-class</a></li><li class="nav-list-item"><a href="/reference/cli/tg-put-kg-core.html" class="nav-list-link">tg-put-kg-core</a></li><li class="nav-list-item"><a href="/reference/cli/tg-remove-library-document.html" class="nav-list-link">tg-remove-library-document</a></li><li class="nav-list-item"><a href="/reference/cli/tg-save-doc-embeds.html" class="nav-list-link">tg-save-doc-embeds</a></li><li class="nav-list-item"><a href="/reference/cli/tg-set-mcp-tool.html" class="nav-list-link">tg-set-mcp-tool</a></li><li class="nav-list-item"><a href="/reference/cli/tg-set-prompt.html" class="nav-list-link">tg-set-prompt</a></li><li class="nav-list-item"><a href="/reference/cli/tg-set-token-costs.html" class="nav-list-link">tg-set-token-costs</a></li><li class="nav-list-item"><a href="/reference/cli/tg-set-tool.html" class="nav-list-link">tg-set-tool</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-config.html" class="nav-list-link">tg-show-config</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-flow-classes.html" class="nav-list-link">tg-show-flow-classes</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-flow-state.html" class="nav-list-link">tg-show-flow-state</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-flows.html" class="nav-list-link">tg-show-flows</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-graph.html" class="nav-list-link">tg-show-graph</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-kg-cores.html" class="nav-list-link">tg-show-kg-cores</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-library-documents.html" class="nav-list-link">tg-show-library-documents</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-library-processing.html" class="nav-list-link">tg-show-library-processing</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-mcp-tools.html" class="nav-list-link">tg-show-mcp-tools</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-processor-state.html" class="nav-list-link">tg-show-processor-state</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-prompts.html" class="nav-list-link">tg-show-prompts</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-token-costs.html" class="nav-list-link">tg-show-token-costs</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-token-rate.html" class="nav-list-link">tg-show-token-rate</a></li><li class="nav-list-item"><a href="/reference/cli/tg-show-tools.html" class="nav-list-link">tg-show-tools</a></li><li class="nav-list-item"><a href="/reference/cli/tg-start-flow.html" class="nav-list-link">tg-start-flow</a></li><li class="nav-list-item"><a href="/reference/cli/tg-start-library-processing.html" class="nav-list-link">tg-start-library-processing</a></li><li class="nav-list-item"><a href="/reference/cli/tg-stop-flow.html" class="nav-list-link">tg-stop-flow</a></li><li class="nav-list-item"><a href="/reference/cli/tg-stop-library-processing.html" class="nav-list-link">tg-stop-library-processing</a></li><li class="nav-list-item"><a href="/reference/cli/tg-unload-kg-core.html" class="nav-list-link">tg-unload-kg-core</a></li></ul></li><li class="nav-list-item"><a href="/reference/containers.html" class="nav-list-link">Containers</a></li><li class="nav-list-item"><a href="/reference/python-packages.html" class="nav-list-link">Python packages</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Extending TrustGraph category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/reference/extending/" class="nav-list-link">Extending TrustGraph</a><ul class="nav-list"><li class="nav-list-item"><a href="/reference/extending/async-processor.html" class="nav-list-link">AsyncProcessor</a></li><li class="nav-list-item"><a href="/reference/extending/flow-processor.html" class="nav-list-link">FlowProcessor</a></li><li class="nav-list-item"><a href="/reference/extending/service-base-classes.html" class="nav-list-link">Service Base Classes</a></li><li class="nav-list-item"><a href="/reference/extending/flow-specifications.html" class="nav-list-link">Flow Specifications</a></li></ul></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Community category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/community/" class="nav-list-link">Community</a><ul class="nav-list"><li class="nav-list-item"><a href="/community/changelog/trustgraph.html" class="nav-list-link">Changelog - TrustGraph</a></li><li class="nav-list-item"><a href="/community/changelog/workbench.html" class="nav-list-link">Changelog - Workbench</a></li><li class="nav-list-item"><a href="/community/code-of-conduct.html" class="nav-list-link">Code of Conduct</a></li><li class="nav-list-item"><a href="/community/contributing.html" class="nav-list-link">Contributing</a></li><li class="nav-list-item"><a href="/community/developer.html" class="nav-list-link">Developer's Guide</a></li><li class="nav-list-item"><a href="/community/roadmap.html" class="nav-list-link">Roadmap</a></li><li class="nav-list-item"><a href="/community/support.html" class="nav-list-link">Support</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Examples category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/examples/" class="nav-list-link">Examples</a><ul class="nav-list"><li class="nav-list-item"><a href="/examples/integrations/" class="nav-list-link">Integrations</a></li><li class="nav-list-item"><a href="/examples/sample-data/" class="nav-list-link">Sample Data</a></li><li class="nav-list-item"><a href="/examples/tutorials/" class="nav-list-link">Tutorials</a></li></ul></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Advanced Topics category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/advanced/" class="nav-list-link">Advanced Topics</a><ul class="nav-list"><li class="nav-list-item"><a href="/advanced/backup-restore.html" class="nav-list-link">Backup & Restore</a></li><li class="nav-list-item"><a href="/advanced/clustering.html" class="nav-list-link">Clustering</a></li><li class="nav-list-item"><a href="/advanced/custom-algorithms.html" class="nav-list-link">Custom Algorithms</a></li><li class="nav-list-item"><a href="/advanced/disaster-recovery.html" class="nav-list-link">Disaster Recovery</a></li><li class="nav-list-item"><button class="nav-list-expander btn-reset" aria-label="toggle items in Extending TrustGraph category" aria-pressed="false">
        <svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
      </button><a href="/advanced/extending-trustgraph.html" class="nav-list-link">Extending TrustGraph</a><ul class="nav-list"><li class="nav-list-item"><a href="/reference/extending/async-processor.html" class="nav-list-link">AsyncProcessor</a></li><li class="nav-list-item"><a href="/reference/extending/flow-processor.html" class="nav-list-link">FlowProcessor</a></li><li class="nav-list-item"><a href="/reference/extending/service-base-classes.html" class="nav-list-link">Service Base Classes</a></li><li class="nav-list-item"><a href="/reference/extending/flow-specifications.html" class="nav-list-link">Flow Specifications</a></li></ul></li><li class="nav-list-item"><a href="/advanced/performance-tuning.html" class="nav-list-link">Performance Tuning</a></li></ul></li></ul></li></ul>
  
</nav>




  
  
    <footer class="site-footer">
      This site uses <a href="https://github.com/just-the-docs/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.
    </footer>
  
</div>

  
  <div class="main" id="top">
    <div id="main-header" class="main-header">
  
    

<div class="search" role="search">
  <div class="search-input-wrap">
    <input type="text" id="search-input" class="search-input" tabindex="0" placeholder="Search TrustGraph" aria-label="Search TrustGraph" autocomplete="off">
    <label for="search-input" class="search-label"><svg viewBox="0 0 24 24" class="search-icon"><use xlink:href="#svg-search"></use></svg></label>
  </div>
  <div id="search-results" class="search-results"></div>
</div>

  
  
  
    <nav aria-label="Auxiliary" class="aux-nav">
  <ul class="aux-nav-list">
    
      <li class="aux-nav-list-item">
        <a href="//github.com/trustgraph-ai/trustgraph" class="site-button"
          
          target="_blank" rel="noopener noreferrer"
          
        >
          TrustGraph on GitHub
        </a>
      </li>
    
  </ul>
</nav>

  
</div>

    <div class="main-content-wrap">
      <nav aria-label="Breadcrumb" class="breadcrumb-nav">
  <ol class="breadcrumb-nav-list">
    <li class="breadcrumb-nav-list-item"><a href="/">TrustGraph Documentation</a></li>
    <li class="breadcrumb-nav-list-item"><a href="/reference/">Reference</a></li>
    <li class="breadcrumb-nav-list-item"><a href="/reference/cli/">CLI</a></li>
    <li class="breadcrumb-nav-list-item"><span>tg-set-mcp-tool</span></li>
  </ol>
</nav>


      <div id="main-content" class="main-content">
        <main>
          
            <h1 id="tg-set-mcp-tool">
  
  
    <a href="#tg-set-mcp-tool" class="anchor-heading" aria-labelledby="tg-set-mcp-tool"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> tg-set-mcp-tool
  
  
</h1>
    
<h2 id="synopsis">
  
  
    <a href="#synopsis" class="anchor-heading" aria-labelledby="synopsis"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Synopsis
  
  
</h2>
    

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tg-set-mcp-tool [OPTIONS] --id ID --tool-url URL
</code></pre></div></div>
<h2 id="description">
  
  
    <a href="#description" class="anchor-heading" aria-labelledby="description"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Description
  
  
</h2>
    

<p>The <code class="language-plaintext highlighter-rouge">tg-set-mcp-tool</code> command configures and registers MCP (Model Context Protocol) tools in the TrustGraph system. MCP tools are external services that follow the Model Context Protocol specification and can be integrated with TrustGraph agents.</p>

<p>This command stores MCP tool configurations in the ‘mcp’ configuration group with:</p>
<ul>
  <li><strong>id</strong>: Unique identifier for the tool</li>
  <li><strong>remote-name</strong>: Name used by the MCP server (defaults to id if not specified)</li>
  <li><strong>url</strong>: MCP server endpoint URL</li>
</ul>

<p>Once configured, MCP tools can be referenced by agent tools using the ‘mcp-tool’ type via the <code class="language-plaintext highlighter-rouge">tg-set-tool</code> command.</p>
<h2 id="options">
  
  
    <a href="#options" class="anchor-heading" aria-labelledby="options"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Options
  
  
</h2>
    

<ul>
  <li><code class="language-plaintext highlighter-rouge">-u, --api-url URL</code>
    <ul>
      <li>TrustGraph API URL to connect to</li>
      <li>Default: <code class="language-plaintext highlighter-rouge">http://localhost:8088/</code> (or <code class="language-plaintext highlighter-rouge">TRUSTGRAPH_URL</code> environment variable)</li>
      <li>Should point to a running TrustGraph API instance</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">-i, --id ID</code>
    <ul>
      <li><strong>Required</strong>: Unique identifier for the MCP tool</li>
      <li>Used to reference the tool in agent configurations</li>
      <li>Must be unique within the MCP tool namespace</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">-r, --remote-name NAME</code>
    <ul>
      <li>Optional: Name used by the MCP server</li>
      <li>Defaults to the value of <code class="language-plaintext highlighter-rouge">--id</code> if not specified</li>
      <li>Useful when the MCP server expects a different name than the local identifier</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">--tool-url URL</code>
    <ul>
      <li><strong>Required</strong>: MCP server endpoint URL</li>
      <li>Should point to a running MCP server that implements the Model Context Protocol</li>
      <li>Must be a valid HTTP/HTTPS URL</li>
    </ul>
  </li>
  <li><code class="language-plaintext highlighter-rouge">-h, --help</code>
    <ul>
      <li>Show help message and exit</li>
    </ul>
  </li>
</ul>
<h2 id="examples">
  
  
    <a href="#examples" class="anchor-heading" aria-labelledby="examples"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Examples
  
  
</h2>
    
<h3 id="basic-mcp-tool-configuration">
  
  
    <a href="#basic-mcp-tool-configuration" class="anchor-heading" aria-labelledby="basic-mcp-tool-configuration"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Basic MCP Tool Configuration
  
  
</h3>
    

<p>Register a weather MCP tool:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tg-set-mcp-tool <span class="nt">--id</span> weather <span class="nt">--tool-url</span> <span class="s2">"http://localhost:3000/weather"</span>
</code></pre></div></div>
<h3 id="mcp-tool-with-custom-remote-name">
  
  
    <a href="#mcp-tool-with-custom-remote-name" class="anchor-heading" aria-labelledby="mcp-tool-with-custom-remote-name"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> MCP Tool with Custom Remote Name
  
  
</h3>
    

<p>Register a calculator tool with a different remote name:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tg-set-mcp-tool <span class="nt">--id</span> calculator <span class="nt">--remote-name</span> calc-service <span class="nt">--tool-url</span> <span class="s2">"http://mcp-tools.example.com/calc"</span>
</code></pre></div></div>
<h3 id="custom-api-url">
  
  
    <a href="#custom-api-url" class="anchor-heading" aria-labelledby="custom-api-url"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Custom API URL
  
  
</h3>
    

<p>Configure MCP tool on a specific TrustGraph instance:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tg-set-mcp-tool <span class="nt">-u</span> http://trustgraph.example.com:8088/ <span class="se">\</span>
  <span class="nt">--id</span> file-reader <span class="nt">--tool-url</span> <span class="s2">"http://localhost:4000/files"</span>
</code></pre></div></div>
<h3 id="remote-mcp-server">
  
  
    <a href="#remote-mcp-server" class="anchor-heading" aria-labelledby="remote-mcp-server"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Remote MCP Server
  
  
</h3>
    

<p>Configure tool pointing to a remote MCP server:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>tg-set-mcp-tool <span class="nt">--id</span> search-engine <span class="se">\</span>
  <span class="nt">--tool-url</span> <span class="s2">"https://mcp-services.example.com/search"</span> <span class="se">\</span>
  <span class="nt">--remote-name</span> web-search
</code></pre></div></div>
<h2 id="integration-with-agent-tools">
  
  
    <a href="#integration-with-agent-tools" class="anchor-heading" aria-labelledby="integration-with-agent-tools"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Integration with Agent Tools
  
  
</h2>
    

<p>After configuring an MCP tool, it can be used by agents through the <code class="language-plaintext highlighter-rouge">tg-set-tool</code> command:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># First, configure the MCP tool</span>
tg-set-mcp-tool <span class="nt">--id</span> weather <span class="nt">--tool-url</span> <span class="s2">"http://localhost:3000/weather"</span>

<span class="c"># Then, create an agent tool that uses the MCP tool</span>
tg-set-tool <span class="nt">--id</span> weather-lookup <span class="nt">--name</span> <span class="s2">"Weather Lookup"</span> <span class="se">\</span>
  <span class="nt">--type</span> mcp-tool <span class="nt">--mcp-tool</span> weather <span class="se">\</span>
  <span class="nt">--description</span> <span class="s2">"Get weather information for a location"</span> <span class="se">\</span>
  <span class="nt">--argument</span> location:string:<span class="s2">"Location to query"</span> <span class="se">\</span>
  <span class="nt">--argument</span> units:string:<span class="s2">"Temperature units (C/F)"</span>
</code></pre></div></div>
<h2 id="configuration-storage">
  
  
    <a href="#configuration-storage" class="anchor-heading" aria-labelledby="configuration-storage"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Configuration Storage
  
  
</h2>
    

<p>MCP tool configurations are stored in the TrustGraph configuration system under the ‘mcp’ type with the following JSON structure:</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nl">"remote-name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"weather-service"</span><span class="p">,</span><span class="w">
  </span><span class="nl">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/weather"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div></div>
<h2 id="mcp-protocol-requirements">
  
  
    <a href="#mcp-protocol-requirements" class="anchor-heading" aria-labelledby="mcp-protocol-requirements"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> MCP Protocol Requirements
  
  
</h2>
    

<p>The MCP tool URL should point to a server that implements the Model Context Protocol specification. The server should:</p>

<ol>
  <li>Accept HTTP POST requests with MCP-compliant message format</li>
  <li>Return responses in the expected MCP format</li>
  <li>Handle authentication and authorization as needed</li>
  <li>Provide proper error handling and status codes</li>
</ol>
<h2 id="error-handling">
  
  
    <a href="#error-handling" class="anchor-heading" aria-labelledby="error-handling"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Error Handling
  
  
</h2>
    

<p>The command handles various error conditions:</p>

<ul>
  <li><strong>Invalid URL format</strong>: If the tool URL is malformed</li>
  <li><strong>API connection errors</strong>: If the TrustGraph API is unavailable</li>
  <li><strong>Authentication errors</strong>: If API access is denied</li>
  <li><strong>Configuration errors</strong>: If the tool configuration cannot be stored</li>
</ul>

<p>Common error scenarios:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Invalid tool URL</span>
tg-set-mcp-tool <span class="nt">--id</span> <span class="nb">test</span> <span class="nt">--tool-url</span> <span class="s2">"not-a-valid-url"</span>
<span class="c"># Output: Exception: [URL validation error]</span>

<span class="c"># API not available</span>
tg-set-mcp-tool <span class="nt">--id</span> <span class="nb">test</span> <span class="nt">--tool-url</span> <span class="s2">"http://localhost:3000"</span> <span class="nt">-u</span> http://invalid-host:8088/
<span class="c"># Output: Exception: [Connection error details]</span>

<span class="c"># Missing required arguments</span>
tg-set-mcp-tool <span class="nt">--id</span> <span class="nb">test</span>
<span class="c"># Output: Exception: Must specify --tool-url for MCP tool</span>
</code></pre></div></div>
<h2 id="verification">
  
  
    <a href="#verification" class="anchor-heading" aria-labelledby="verification"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Verification
  
  
</h2>
    

<p>After configuring an MCP tool, verify it was stored correctly:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># List all MCP tools</span>
tg-show-mcp-tools

<span class="c"># Check if specific tool exists</span>
tg-show-mcp-tools | <span class="nb">grep</span> <span class="nt">-A</span> 5 <span class="s2">"weather"</span>
</code></pre></div></div>
<h2 id="best-practices">
  
  
    <a href="#best-practices" class="anchor-heading" aria-labelledby="best-practices"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Best Practices
  
  
</h2>
    

<ol>
  <li><strong>Use descriptive IDs</strong>: Choose clear, descriptive identifiers for MCP tools</li>
  <li><strong>Test connectivity</strong>: Verify the MCP server is accessible before configuration</li>
  <li><strong>Document tools</strong>: Keep track of MCP tool purposes and configurations</li>
  <li><strong>Monitor health</strong>: Regularly check that MCP servers are responding correctly</li>
  <li><strong>Version control</strong>: Track MCP tool configuration changes</li>
</ol>
<h2 id="security-considerations">
  
  
    <a href="#security-considerations" class="anchor-heading" aria-labelledby="security-considerations"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Security Considerations
  
  
</h2>
    

<ul>
  <li>Ensure MCP server URLs use HTTPS in production environments</li>
  <li>Validate that MCP servers implement proper authentication</li>
  <li>Review MCP tool permissions and capabilities</li>
  <li>Monitor MCP tool usage and access patterns</li>
</ul>
<h2 id="related-commands">
  
  
    <a href="#related-commands" class="anchor-heading" aria-labelledby="related-commands"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> Related Commands
  
  
</h2>
    

<ul>
  <li><a href="tg-show-mcp-tools"><code class="language-plaintext highlighter-rouge">tg-show-mcp-tools</code></a> - Display configured MCP tools</li>
  <li><a href="tg-delete-mcp-tool"><code class="language-plaintext highlighter-rouge">tg-delete-mcp-tool</code></a> - Remove MCP tool configuration</li>
  <li><a href="tg-invoke-mcp-tool"><code class="language-plaintext highlighter-rouge">tg-invoke-mcp-tool</code></a> - Test MCP tool functionality</li>
  <li><a href="tg-set-tool"><code class="language-plaintext highlighter-rouge">tg-set-tool</code></a> - Configure agent tools that use MCP tools</li>
  <li><a href="tg-show-tools"><code class="language-plaintext highlighter-rouge">tg-show-tools</code></a> - Display all agent tools</li>
</ul>
<h2 id="see-also">
  
  
    <a href="#see-also" class="anchor-heading" aria-labelledby="see-also"><svg viewBox="0 0 16 16" aria-hidden="true"><use xlink:href="#svg-link"></use></svg></a> See Also
  
  
</h2>
    

<ul>
  <li>Model Context Protocol Specification</li>
  <li>TrustGraph Agent Tool Configuration</li>
  <li>MCP Integration Guide</li>
</ul>

          

          
            
          
        </main>
        

  <hr>
  <footer>
    

    <p class="text-small text-grey-dk-100 mb-0">Copyright &copy; 2024-2025 TrustGraph.ai. Distributed under an <a href="https://github.com/trustgraph-ai/trustgraph/blob/master/LICENSE">Apache 2 license.</a></p>

    
      <div class="d-flex mt-2">
        
        
          <p class="text-small text-grey-dk-000 mb-0">
            <a href="https://github.com/trustgraph-ai/trustgraph-ai.github.io/tree/main/reference/cli/tg-set-mcp-tool.md" id="edit-this-page">Edit this page on GitHub.</a>
          </p>
        
      </div>
    
  </footer>


      </div>
    </div>
    
      

<div class="search-overlay"></div>

    
  </div>

  
    






  <script src="https://cdn.jsdelivr.net/npm/mermaid@9.1.3/dist/mermaid.min.js"></script>


<script>
  var config = {}
;
  mermaid.initialize(config);
  window.mermaid.init(undefined, document.querySelectorAll('.language-mermaid'));
</script>



  
</body>
</html>



Summary:"

Variable Naming

# Use descriptive variable names
tg-set-prompt \
  --id "descriptive-vars" \
  --prompt "Analyze  data from  for  trends"

# Group related variables
tg-set-prompt \
  --id "grouped-vars" \
  --prompt "Compare  vs  using "

Environment Variables

  • TRUSTGRAPH_URL: Default API URL

API Integration

This command uses the Config API to store prompt templates and system prompts in TrustGraph’s configuration system.

Best Practices

  1. Clear Templates: Write clear, specific prompt templates
  2. Variable Names: Use descriptive variable names
  3. Response Types: Choose appropriate response types for your use case
  4. Schema Validation: Always validate JSON schemas before setting
  5. Version Control: Consider versioning important templates
  6. Testing: Test templates thoroughly with various inputs
  7. Documentation: Document template variables and expected usage

Troubleshooting

Template Not Working

# Check template exists
tg-show-prompts | grep "template-id"

# Verify variable names match
tg-invoke-prompt template-id var1="test" var2="test"

JSON Schema Errors

# Validate schema separately
echo '{"type": "object"}' | jq .

# Test with simple schema first
tg-set-prompt --id "test" --prompt "test" --response "json" --schema '{"type": "string"}'

System Prompt Issues

# Check current system prompt
tg-show-prompts | grep -A5 "System prompt"

# Reset if needed
tg-set-prompt --system "Default system prompt"