Skip to content

Class: PackDefinitionBuilder

Defined in: builder.ts:57

A class that assists in constructing a pack definition. Use newPack to create one.

Implements

Constructors

Constructor

new PackDefinitionBuilder(definition?): PackDefinitionBuilder

Defined in: builder.ts:131

Constructs a PackDefinitionBuilder. However, coda.newPack() should be used instead rather than constructing a builder directly.

Parameters

Parameter Type
definition? Partial<PackVersionDefinition>

Returns

PackDefinitionBuilder

Properties

defaultAuthentication?

optional defaultAuthentication: Authentication

Defined in: builder.ts:106

See PackVersionDefinition.defaultAuthentication.

Implementation of

PackDefinition.defaultAuthentication


formats

formats: Format[]

Defined in: builder.ts:65

See PackVersionDefinition.formats.

Implementation of

PackDefinition.formats


formulaNamespace?

optional formulaNamespace: string

Defined in: builder.ts:123

Deprecated

Implementation of

PackDefinition.formulaNamespace


formulas

formulas: Formula[]

Defined in: builder.ts:61

See PackVersionDefinition.formulas.

Implementation of

PackDefinition.formulas


networkDomains

networkDomains: string[]

Defined in: builder.ts:96

See PackVersionDefinition.networkDomains.

Implementation of

PackDefinition.networkDomains


skillEntrypoints?

optional skillEntrypoints: SkillEntrypoints

Defined in: builder.ts:77

See PackVersionDefinition.skillEntrypoints.

Implementation of

PackDefinition.skillEntrypoints


skills

skills: Skill[]

Defined in: builder.ts:73

See PackVersionDefinition.skills.

Implementation of

PackDefinition.skills


syncTables

syncTables: SyncTable[]

Defined in: builder.ts:69

See PackVersionDefinition.syncTables.

Implementation of

PackDefinition.syncTables


systemConnectionAuthentication?

optional systemConnectionAuthentication: SystemAuthentication

Defined in: builder.ts:110

See PackVersionDefinition.systemConnectionAuthentication.

Implementation of

PackDefinition.systemConnectionAuthentication


version?

optional version: string

Defined in: builder.ts:121

See PackVersionDefinition.version.

Methods

addColumnFormat()

addColumnFormat(format): this

Defined in: builder.ts:285

Adds a column format definition to this pack.

In the web editor, the /ColumnFormat shortcut will insert a snippet of a skeleton format.

Example

pack.addColumnFormat({
  name: 'MyColumn',
  formulaName: 'MyFormula',
});

Parameters

Parameter Type
format Format

Returns

this


addDynamicSyncTable()

addDynamicSyncTable<K, L, ParamDefsT, SchemaT, ContextT, PermissionsContextT>(definition): this

Defined in: builder.ts:256

Adds a dynamic sync table definition to this pack.

In the web editor, the /DynamicSyncTable shortcut will insert a snippet of a skeleton sync table.

Example

pack.addDynamicSyncTable({
  name: "MySyncTable",
  getName: async funciton (context) => {
    const response = await context.fetcher.fetch({method: "GET", url: context.sync.dynamicUrl});
    return response.body.name;
  },
  getName: async function (context) => {
    const response = await context.fetcher.fetch({method: "GET", url: context.sync.dynamicUrl});
    return response.body.browserLink;
  },
  ...
});

Type Parameters

Type Parameter
K extends string
L extends string
ParamDefsT extends ParamDefs
SchemaT extends ObjectSchemaDefinition<K, L>
ContextT extends SyncExecutionContext<any, any, any>
PermissionsContextT extends SyncPassthroughData

Parameters

Parameter Type
definition DynamicSyncTableOptions<K, L, ParamDefsT, SchemaT, ContextT, PermissionsContextT>

Returns

this


addFormula()

addFormula<ParamDefsT, ResultT, SchemaT>(definition): this

Defined in: builder.ts:188

Adds a formula definition to this pack.

In the web editor, the /Formula shortcut will insert a snippet of a skeleton formula.

Example

pack.addFormula({
  resultType: ValueType.String,
   name: 'MyFormula',
   description: 'My description.',
   parameters: [
     makeParameter({
       type: ParameterType.String,
       name: 'myParam',
       description: 'My param description.',
     }),
   ],
   execute: async ([param]) => {
     return `Hello ${param}`;
   },
});

Type Parameters

Type Parameter
ParamDefsT extends ParamDefs
ResultT extends ValueType
SchemaT extends Schema

Parameters

Parameter Type
definition object & FormulaDefinitionOptions<ParamDefsT, ResultT, SchemaT>

Returns

this


addMCPServer()

addMCPServer(server): this

Defined in: builder.ts:325

Adds an MCP server to this pack.

Example

pack.addMCPServer({name: 'MyMCPServer', endpointUrl: 'https://my-mcp-server.com'});

Parameters

Parameter Type
server MCPServer

Returns

this


addNetworkDomain()

addNetworkDomain(...domain): this

Defined in: builder.ts:524

Adds the domain that this pack makes HTTP requests to. For example, if your pack makes HTTP requests to "api.example.com", use "example.com" as your network domain.

If your pack make HTTP requests, it must declare a network domain, for security purposes. Coda enforces that your pack cannot make requests to any undeclared domains.

You are allowed one network domain per pack by default. If your pack needs to connect to multiple domains, contact Coda Support for approval.

Example

pack.addNetworkDomain('example.com');

Parameters

Parameter Type
...domain string[]

Returns

this


addSkill()

addSkill(skill): this

Defined in: builder.ts:312

Adds an agent skill definition to this pack.

In the web editor, the /Skill shortcut will insert a snippet of a skeleton skill.

Example

pack.addSkill({
  name: "MySkill",
  displayName: "My Display Name",
  description: "My description.",
  prompt: `My prompt.`,
  tools: [
    { type: coda.ToolType.Pack },
    {
      type: coda.ToolType.Knowledge,
      source: { type: coda.KnowledgeToolSourceType.Pack },
    },
  ],
});

Parameters

Parameter Type
skill Skill

Returns

this


addSyncTable()

addSyncTable<K, L, ParamDefsT, SchemaT, ContextT, PermissionsContextT>(definition): this

Defined in: builder.ts:218

Adds a sync table definition to this pack.

In the web editor, the /SyncTable shortcut will insert a snippet of a skeleton sync table.

Example

pack.addSyncTable({
  name: 'MySyncTable',
  identityName: 'EntityName',
  schema: coda.makeObjectSchema({
    ...
  }),
  formula: {
    ...
  },
});

Type Parameters

Type Parameter
K extends string
L extends string
ParamDefsT extends ParamDefs
SchemaT extends ObjectSchema<K, L>
ContextT extends SyncExecutionContext<any, any, any>
PermissionsContextT extends SyncPassthroughData

Parameters

Parameter Type
definition SyncTableOptions<K, L, ParamDefsT, SchemaT, ContextT, PermissionsContextT>

Returns

this


setBenchInitializationSkill()

setBenchInitializationSkill(skill): this

Defined in: builder.ts:372

Sets the skill used when the agent is first opened in the agent bench.

Example

pack.setBenchInitializationSkill({
  name: "Greeting",
  displayName: "Greeting",
  description: "Greet the user.",
  prompt: `
    Say hello to the user, referencing the time of day and a friendly nickname.
    For example: 10AM, Kramer => "Good morning K-man!"
  `,
  tools: [],
});

Parameters

Parameter Type
skill Skill

Returns

this


setChatSkill()

setChatSkill(skill): this

Defined in: builder.ts:350

Sets the chat skill for this pack's agent.

The chat skill controls the behavior when users chat with the pack agent. It defines the prompts, available tools, and optionally the model to use.

Example

pack.setChatSkill({
  name: "Cow",
  displayName: "Cow",
  description: "Talk like a cow.",
  prompt: `
    End every reply with "Moo!".
  `,
  tools: [
    { type: coda.ToolType.Pack },
  ],
});

Parameters

Parameter Type
skill Skill

Returns

this


setSkillEntrypoints()

setSkillEntrypoints(entrypoints): this

Defined in: builder.ts:389

Maps agent entrypoints to skills in the Pack.

Example

pack.setSkillEntrypoints({
  defaultChat: { skillName: "MySkill" },
});

Deprecated

Use PackDefinitionBuilder.setChatSkill instead.

Parameters

Parameter Type
entrypoints SkillEntrypoints

Returns

this


setSystemAuthentication()

setSystemAuthentication(systemAuthentication): this

Defined in: builder.ts:484

Sets this pack to use authentication provided by you as the maker of this pack.

You will need to register credentials to use with this pack. When users use the pack, their requests will be authenticated with those system credentials, they need not register their own account.

In the web editor, the /SystemAuthentication shortcut will insert a snippet of a skeleton authentication definition.

Example

pack.setSystemAuthentication({
  type: AuthenticationType.HeaderBearerToken,
});

Parameters

Parameter Type
systemAuthentication SystemAuthenticationDef

Returns

this


setUserAuthentication()

setUserAuthentication(authDef): this

Defined in: builder.ts:452

Sets this pack to use authentication for individual users, using the authentication method is the given definition.

Each user will need to register an account in order to use this pack.

In the web editor, the /UserAuthentication shortcut will insert a snippet of a skeleton authentication definition.

By default, this will set a default connection (account) requirement, making a user account required to invoke all formulas in this pack unless you specify differently on a particular formula. To change the default, you can pass a defaultConnectionRequirement option into this method.

Example

pack.setUserAuthentication({
  type: AuthenticationType.HeaderBearerToken,
});

Parameters

Parameter Type
authDef UserAuthenticationDef

Returns

this


setVersion()

setVersion(version): this

Defined in: builder.ts:542

Sets the semantic version of this pack version, e.g. '1.2.3'.

This is optional, and you only need to provide a version if you are manually doing semantic versioning, or using the CLI. If using the web editor, you can omit this and the web editor will automatically provide an appropriate semantic version each time you build a version.

Example

pack.setVersion('1.2.3');

Parameters

Parameter Type
version string

Returns

this