Skip to main content
Glama

createConnection

Establish a connection to cloud storage sources like Notion or Google Drive to authorize document ingestion into knowledge bases.

Instructions

Creates a new connection to a specific source. The connector parameter should be a valid SourceSync connector enum value. The clientRedirectUrl parameter is optional and can be used to specify a custom redirect URL for the connection. This will give you a authorization url which you can redirect the user to. The user will then be asked to pick the documents they want to ingest.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceIdNo
nameYes
connectorYes
clientRedirectUrlNo
tenantIdNo

Implementation Reference

  • src/index.ts:636-656 (registration)
    Registers the MCP tool 'createConnection' with description, schema, and inline handler function that delegates to SourceSync client.
    server.tool(
      'createConnection',
      'Creates a new connection to a specific source. The connector parameter should be a valid SourceSync connector enum value. The clientRedirectUrl parameter is optional and can be used to specify a custom redirect URL for the connection. This will give you a authorization url which you can redirect the user to. The user will then be asked to pick the documents they want to ingest.',
      CreateConnectionSchema.shape,
      async (params: any) => {
        return safeApiCall(async () => {
          const { namespaceId, name, connector, clientRedirectUrl, tenantId } =
            params
    
          // Create a client with the provided parameters
          const client = createClient({ namespaceId, tenantId })
    
          // Call the createConnection method with the connector as enum
          return await client.createConnection({
            name,
            connector,
            clientRedirectUrl,
          })
        })
      },
    )
  • Handler function for the 'createConnection' tool. Creates a SourceSyncApiClient instance and invokes its createConnection method, wrapped in error-handling safeApiCall.
    async (params: any) => {
      return safeApiCall(async () => {
        const { namespaceId, name, connector, clientRedirectUrl, tenantId } =
          params
    
        // Create a client with the provided parameters
        const client = createClient({ namespaceId, tenantId })
    
        // Call the createConnection method with the connector as enum
        return await client.createConnection({
          name,
          connector,
          clientRedirectUrl,
        })
      })
  • Zod schema defining input parameters for the createConnection tool: namespaceId (opt), name, connector (enum), clientRedirectUrl (opt), tenantId (opt).
    export const CreateConnectionSchema = z.object({
      namespaceId: namespaceIdSchema.optional(),
      name: z.string(),
      connector: ConnectorEnum,
      clientRedirectUrl: z.string().optional(),
      tenantId: tenantIdSchema,
    })
  • SourceSyncApiClient.createConnection method: sends POST request to /v1/connections API endpoint with connection details to create a new connection.
    public async createConnection({
      name,
      connector,
      clientRedirectUrl,
    }: Omit<
      SourceSyncCreateConnectionRequest,
      'namespaceId'
    >): Promise<SourceSyncCreateConnectionResponse> {
      return this.client
        .url('/v1/connections')
        .json({
          namespaceId: this.namespaceId,
          name,
          connector,
          clientRedirectUrl,
        } satisfies SourceSyncCreateConnectionRequest)
        .post()
        .json<SourceSyncCreateConnectionResponse>()
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool initiates an OAuth-like flow (authorization URL, user redirection, document selection), which is valuable behavioral context. However, it lacks details on permissions required, rate limits, error handling, or what happens after user authorization (e.g., automatic ingestion). For a tool with no annotations, this is a significant gap.

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 description is appropriately sized with three sentences that are front-loaded: the first states the purpose, the second explains key parameters, and the third describes the authorization flow. There's minimal waste, though the third sentence could be more concise.

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

Completeness2/5

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

Given the complexity (OAuth-like flow, 5 parameters), no annotations, and no output schema, the description is incomplete. It misses details on parameter semantics for three parameters, behavioral aspects like error handling, and the return value (only mentions an authorization URL). For a tool with this complexity, it should do more to guide the agent.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must compensate. It explains two parameters: 'connector' (as a SourceSync enum) and 'clientRedirectUrl' (optional, for custom redirect). However, it doesn't cover the other three parameters (namespaceId, name, tenantId), leaving them undocumented. The description adds some value but doesn't fully compensate for the coverage gap.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Creates a new connection to a specific source.' It specifies the verb ('creates') and resource ('connection'), and mentions the authorization flow and document ingestion outcome. However, it doesn't explicitly differentiate from sibling tools like 'updateConnection' or 'listConnections' beyond the creation aspect.

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

Usage Guidelines3/5

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

The description implies usage context by mentioning the authorization URL and user document selection, suggesting it's for setting up data ingestion from external sources. It doesn't provide explicit when-to-use guidance versus alternatives like 'ingestConnector' or 'ingestFile', nor does it mention prerequisites or exclusions.

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