NIN Connect Docs
Platform (Self-Host)Dashboard

Tools

How to define API actions within a plugin — HTTP method, path, input/output schemas, and headers.

What is a Tool?

A tool is a single API action within a plugin. There are two types:

  • Manual tools — mapped to one HTTP endpoint on the external service. You define the method, path, and schemas. The runtime proxy uses these to build and execute HTTP requests.
  • MCP tools — auto-discovered from the plugin's MCP server. Read-only, managed automatically via the MCP protocol.

When an AI agent calls session.execute("TOOL_SLUG", params), NIN routes the call to either the REST proxy (manual) or the MCP server (MCP) based on the tool's source.

Tool Fields

FieldTypeRequiredDescription
slugstringYesUnique within the plugin, uppercase with underscores (e.g. GMAIL_SEND_EMAIL)
namestringYesHuman-readable name (e.g. "Send Email")
descriptionstringYesWhat the tool does — shown to agents for tool selection
methodstringYesHTTP method: GET, POST, PUT, PATCH, or DELETE
pathstringYesURL path appended to the plugin's base URL (e.g. /v1/messages/send)
inputSchemaJSONNoJSON Schema describing the expected parameters
outputSchemaJSONNoJSON Schema describing the response shape
headersJSONNoStatic headers merged into every request for this tool
enabledbooleanNoWhether the tool is available (default: true)

Path Parameters

Paths can contain {placeholder} segments that are interpolated from the params at execution time. For example:

  • Path: /v1/users/{userId}/messages
  • Params: { userId: "abc123", text: "hello" }
  • Result: GET /v1/users/abc123/messages with { text: "hello" } as body

Any param that matches a {placeholder} in the path is used for interpolation. Remaining params become the request body (for non-GET methods).

Creating a Tool

  1. Open a plugin's detail page
  2. Go to the Tools tab
  3. Click Add Tool
  4. Fill in slug, name, description, method, and path
  5. Optionally provide input/output JSON schemas and static headers
  6. Save

Execution Flow

When a tool is executed via POST /api/v1/tools/execute:

  1. The tool is resolved by slug
  2. Plugin's base URL is fetched
  3. End-user's connected account is found
  4. Credentials are decrypted and auth is injected into headers
  5. Path params are interpolated, remaining params become the body
  6. HTTP request is sent to {baseUrl}{path}
  7. Response is returned with status and latency
  8. Execution is logged to execution_logs

MCP Tools

For plugins with toolSource set to "mcp" or "both", tools are auto-discovered from the MCP server.

MCP Tool Cache (mcpToolCache)

Discovered MCP tools are stored in the mcp_tool_cache table:

FieldTypeDescription
iduuidPrimary key
pluginIduuidReferences the plugin
mcpToolNamestringOriginal name from the MCP server (e.g. notion-search)
slugstringNormalized slug (e.g. NOTION_SEARCH)
namestringDisplay name
descriptionstringTool description from the MCP server
inputSchemajsonbJSON Schema for tool parameters
lastSyncedAttimestampWhen this tool was last synced

A unique constraint on (pluginId, mcpToolName) ensures no duplicate tools per plugin.

Syncing MCP Tools

MCP tools can be synced in two ways:

  1. Realtime — when getTools() is called with a userId, NIN connects to the MCP server live and fetches current tools. The cache is updated as a side effect.
  2. Manual sync — click Sync Tools on the plugin detail page or Sync to Plugin Toolkit on a connection card. This triggers a sync using the admin's or user's MCP token.

MCP Tools in the Dashboard

MCP tools appear as read-only cards in the plugin's Tools tab. They show:

  • Tool name and description (expandable)
  • Input schema (viewable via Schema button)
  • lastSyncedAt timestamp
  • An MCP badge to distinguish from manual tools

MCP tools cannot be edited or deleted manually — they are managed by the MCP server.

API Endpoints

Manual Tools

MethodPathDescription
POST/api/dashboard/plugins/[pluginId]/toolsCreate a manual tool
PUT/api/dashboard/plugins/[pluginId]/toolsUpdate a manual tool (by id in body)
DELETE/api/dashboard/plugins/[pluginId]/tools?id=...Delete a manual tool

MCP Tools

MethodPathDescription
POST/api/dashboard/plugins/[pluginId]/mcp-syncSync MCP tools from the server to cache
GET/api/dashboard/connections/[connectionId]/toolsFetch tools for a specific connection (live for MCP)

All tool endpoints require admin authentication.

On this page