tmcp 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmcp",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "The main tmcp library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -600,7 +600,7 @@ export class McpServer {
600
600
  #init_completion() {
601
601
  this.#server.addMethod(
602
602
  'completion/complete',
603
- ({ argument, ref, context }) => {
603
+ async ({ argument, ref, context }) => {
604
604
  const completions = this.#completions[ref.type];
605
605
  if (!completions) return null;
606
606
  const complete = completions.get(ref.uri ?? ref.name);
@@ -609,7 +609,7 @@ export class McpServer {
609
609
  if (!actual_complete) return null;
610
610
  return v.parse(
611
611
  CompleteResultSchema,
612
- actual_complete(argument.value, context),
612
+ await actual_complete(argument.value, context),
613
613
  );
614
614
  },
615
615
  );
@@ -26,7 +26,7 @@ export type Tool<TSchema extends StandardSchemaV1 = StandardSchemaV1<any>> = {
26
26
  export type Completion = (
27
27
  query: string,
28
28
  context: { arguments: Record<string, string> },
29
- ) => CompleteResult;
29
+ ) => CompleteResult | Promise<CompleteResult>;
30
30
 
31
31
  export type Prompt<TSchema extends StandardSchemaV1 = StandardSchemaV1<any>> = {
32
32
  description: string;
@@ -116,7 +116,7 @@ declare module 'tmcp' {
116
116
  type Completion = (
117
117
  query: string,
118
118
  context: { arguments: Record<string, string> },
119
- ) => CompleteResult;
119
+ ) => CompleteResult | Promise<CompleteResult>;
120
120
 
121
121
  type ServerOptions<TSchema extends StandardSchemaV1> = {
122
122
  capabilities?: ServerCapabilities;