@gram-ai/create-function 0.3.2 → 0.4.0

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.
@@ -26,3 +26,20 @@ export async function handleToolCall(call: {
26
26
  headers: { "Content-Type": "application/json; mcp=tools_call" },
27
27
  });
28
28
  }
29
+
30
+ export async function handleResources(call: {
31
+ uri: string;
32
+ input: string;
33
+ _meta?: Record<string, unknown>;
34
+ }): Promise<Response> {
35
+ const response = await client.readResource({
36
+ uri: call.uri,
37
+ _meta: call._meta,
38
+ });
39
+
40
+ const body = JSON.stringify(response);
41
+ return new Response(body, {
42
+ status: 200,
43
+ headers: { "Content-Type": "application/json" },
44
+ });
45
+ }
@@ -20,3 +20,24 @@ server.registerTool(
20
20
  };
21
21
  },
22
22
  );
23
+
24
+ server.registerResource(
25
+ "a-cool-photo",
26
+ "resources://a-cool-photo",
27
+ {
28
+ mimeType: "image/jpg",
29
+ description: "This photo is really something",
30
+ title: "A Cool Photo",
31
+ },
32
+ async (uri) => {
33
+ let res = await fetch("https://picsum.photos/200/300.jpg");
34
+ return {
35
+ contents: [
36
+ {
37
+ uri: uri.href,
38
+ blob: Buffer.from(await res.arrayBuffer()).toString("base64"),
39
+ },
40
+ ],
41
+ };
42
+ },
43
+ );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gram-ai/create-function",
4
- "version": "0.3.2",
4
+ "version": "0.4.0",
5
5
  "description": "Build AI tools and deploy them to getgram.ai",
6
6
  "keywords": [],
7
7
  "homepage": "https://github.com/speakeasy-api/gram",
@@ -38,7 +38,7 @@
38
38
  "prettier": "^3.6.2",
39
39
  "typescript": "5.9.2",
40
40
  "zod": "^3.25.76",
41
- "@gram-ai/functions": "^0.3.2"
41
+ "@gram-ai/functions": "^0.4.0"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsc --noEmit false"