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>()
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It discloses that the tool creates a connection (implying a write/mutation operation) and describes the OAuth-like flow with user redirection and document selection. However, it lacks critical behavioral details: whether this is idempotent, what permissions are required, error handling, rate limits, or what happens if a connection already exists. For a mutation tool with zero annotation coverage, this is insufficient.

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. It's front-loaded with the core purpose, followed by parameter guidance and behavioral context. There's minimal waste, though the last sentence about user document selection could be integrated more tightly. Overall, it's efficient and well-structured.

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 (5 parameters, mutation operation, no annotations, no output schema), the description is incomplete. It covers the basic purpose and some parameter semantics but misses critical context: no output details (what does it return?), no error handling, no prerequisites, and incomplete parameter documentation. For a tool that initiates authentication flows, this leaves significant gaps for an AI 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 that 'connector' should be a valid SourceSync connector enum value and that 'clientRedirectUrl' is optional for custom redirects. However, it doesn't mention the other 3 parameters (namespaceId, name, tenantId), leaving them undocumented. The description adds some value for 2 out of 5 parameters 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 creates a new connection to a specific source, which is a specific verb+resource combination. It distinguishes from siblings like 'getConnection' (read) and 'updateConnection' (modify), but doesn't explicitly differentiate from 'ingestConnector' which might be related. The purpose is clear but sibling differentiation could be more explicit.

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 that it 'gives you an authorization url which you can redirect the user to' and that 'the user will then be asked to pick the documents they want to ingest.' This suggests the tool is for setting up authentication flows for document ingestion. However, it doesn't explicitly state when to use this 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.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sitegpt/sourcesyncai-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server