Skip to main content
Glama

Link datasource to client

link_datasource

Point a client at one of the account's datasource connections — the connect panel's account picker, as a tool. Call it with just client_id + datasource_id to see the choices, then again with the id you picked. It lists the connections first when there is more than one for the datasource. Three shapes, decided by the datasource: ones with no accounts (Stripe, Shopify, Klaviyo…) link immediately; most take one pick; six take two — Google Ads and Local Services Ads (manager then customer), Meta and Instagram Ads (business then ad account), GA4 (account then property), Business Profile (account then one or more locations). For those, pass the first pick as account_id and the second as sub_account_ids. Linking re-fetches the client's widgets on that datasource in the background — get_widget_data reads them as they land.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idYesClient to link (from list_clients)
account_idNoThe account to link — or, for a two-step datasource, the container to look inside. Omit to list the choices
manual_valueNoFor a datasource that is told what to report on instead of offering a list — Ahrefs takes a domain. Call without it and the tool names the value it wants
datasource_idYesDatasource alias (from datasources)
connection_nameNoWhich connection to use. Omit it: with one connection for this datasource the tool uses it, with several it lists them
sub_account_idsNoTwo-step datasources only: what to link inside account_id (Business Profile takes several locations; the rest take one)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNoEither the link that was made, or — when the call was ambiguous — the choices to pick from: the connections for this datasource, or the accounts inside one. Ask the user which, then call again naming it.
successYesTrue when the call succeeded. A failure comes back as an error result instead.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "data": {
      +      "description": "Either the link that was made, or — when the call was ambiguous — the choices to pick from: the connections for this datasource, or the accounts inside one. Ask the user which, then call again naming it."
      +    },
      +    "success": {
      +      "description": "True when the call succeeded. A failure comes back as an error result instead.",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "success"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations carry only readOnlyHint=false, openWorldHint=true, and destructiveHint=false; the description adds the substantive behavior — it lists connections before linking when several exist, changes its interaction shape by datasource (with named examples: Stripe/Shopify/Klaviyo link immediately; Google Ads, Meta, GA4, and Business Profile require two picks), and re-fetches the client's widgets in the background after linking. Nothing in the description contradicts the annotations, and the side-effect disclosure goes well beyond what the structured fields could convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded in the first sentence and the multi-step protocol follows immediately, with the shape taxonomy and background-refresh note placed after. The length is substantial but every section earns its place given the tool's complexity — though the 'lists the connections first' sentence partially duplicates the connection_name schema description, which is a minor redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a six-parameter tool with three interaction shapes, connection-selection logic, a manual-value path, and background side effects, the description plus schema covers purpose, calling sequence, per-shape parameter rules, and the post-link widget refresh; the presence of an output schema covers return values. An agent can correctly invoke this tool across all datasource shapes from this definition alone.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with individually strong parameter descriptions (omit-to-list semantics on account_id, the Ahrefs-domain case on manual_value, connection fallback rules on connection_name), so the baseline is 3. The description adds cross-parameter value the schema cannot express: it enumerates the six two-step datasources and maps each shape to the account_id + sub_account_ids combination, turning per-parameter hints into an actionable decision procedure.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb-plus-resource statement — 'Point a client at one of the account's datasource connections' — and frames the tool as 'the connect panel's account picker, as a tool,' which clearly distinguishes it from connection-management siblings like create_connection, test_connection, and unlink_datasource. The multi-call picker protocol is stated immediately, so an agent understands this is a selection workflow rather than a one-shot write.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description spells out the calling protocol ('Call it with just client_id + datasource_id to see the choices, then again with the id you picked') and enumerates the three shape-dependent paths with concrete conditions for each, giving an agent clear context for how to drive the interaction. It names get_widget_data as the follow-on reader, but it never explicitly rules out alternatives — the distinction from unlink_datasource or connected_datasources is left to inference rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources