@@ -29,7 +29,8 @@ import {
29
29
IntegrationServiceTypes ,
30
30
TwitterListingTypes ,
31
31
ConversationSearchTypes ,
32
- PromptStrategyTypes
32
+ PromptStrategyTypes ,
33
+ OpenAiImageModels
33
34
} from "graphlit-client/dist/generated/graphql-types.js" ;
34
35
35
36
export function registerTools ( server : McpServer ) {
@@ -2958,7 +2959,7 @@ export function registerTools(server: McpServer) {
2958
2959
`Screenshots web page from URL.
2959
2960
Executes *synchronously* and returns the content identifier.` ,
2960
2961
{
2961
- url : z . string ( )
2962
+ url : z . string ( ) . describe ( "Web page URL." )
2962
2963
} ,
2963
2964
async ( { url } ) => {
2964
2965
const client = new Graphlit ( ) ;
@@ -2994,8 +2995,8 @@ export function registerTools(server: McpServer) {
2994
2995
Accepts image URL as string.
2995
2996
Returns Markdown text from LLM completion.` ,
2996
2997
{
2997
- prompt : z . string ( ) ,
2998
- url : z . string ( )
2998
+ prompt : z . string ( ) . describe ( "Prompt for image description." ) ,
2999
+ url : z . string ( ) . describe ( "Image URL." )
2999
3000
} ,
3000
3001
async ( { prompt, url } ) => {
3001
3002
const client = new Graphlit ( ) ;
@@ -3029,8 +3030,8 @@ export function registerTools(server: McpServer) {
3029
3030
Accepts content identifier as string, and optional prompt for image description.
3030
3031
Returns Markdown text from LLM completion.` ,
3031
3032
{
3032
- id : z . string ( ) ,
3033
- prompt : z . string ( ) . optional ( ) ,
3033
+ id : z . string ( ) . describe ( "Content identifier." ) ,
3034
+ prompt : z . string ( ) . optional ( ) . describe ( "Prompt for image description, optional." ) ,
3034
3035
} ,
3035
3036
async ( { prompt, id } ) => {
3036
3037
const client = new Graphlit ( ) ;
@@ -3094,10 +3095,10 @@ export function registerTools(server: McpServer) {
3094
3095
You *must* retrieve the content resource to get the downloadable audio URL for this published audio.
3095
3096
Executes *synchronously* and returns the content identifier.` ,
3096
3097
{
3097
- name : z . string ( ) ,
3098
- text : z . string ( ) ,
3099
- textType : z . nativeEnum ( TextTypes ) . optional ( ) . default ( TextTypes . Markdown ) ,
3100
- voice : z . string ( ) . optional ( ) . default ( "HqW11As4VRPkApNPkAZp" ) ,
3098
+ name : z . string ( ) . describe ( "Name for the content object." ) ,
3099
+ text : z . string ( ) . describe ( "Text content to publish." ) ,
3100
+ textType : z . nativeEnum ( TextTypes ) . optional ( ) . default ( TextTypes . Markdown ) . describe ( "Text type (Plain, Markdown, Html). Defaults to Markdown." ) ,
3101
+ voice : z . string ( ) . optional ( ) . default ( "HqW11As4VRPkApNPkAZp" ) . describe ( "ElevenLabs voice identifier, optional." ) ,
3101
3102
} ,
3102
3103
async ( { name, text, textType, voice } ) => {
3103
3104
const client = new Graphlit ( ) ;
@@ -3129,16 +3130,57 @@ export function registerTools(server: McpServer) {
3129
3130
}
3130
3131
) ;
3131
3132
3133
+ server . tool (
3134
+ "publishImage" ,
3135
+ `Publishes text as image format, and ingests into Graphlit knowledge base.
3136
+ Accepts a name for the content object.
3137
+ Also, accepts a prompt for image generation. For example, 'Create a cartoon image of a raccoon, saying "I Love Graphlit"'.
3138
+ You *must* retrieve the content resource to get the downloadable image URL for this published image.
3139
+ Executes *synchronously* and returns the content identifier.` ,
3140
+ {
3141
+ name : z . string ( ) . describe ( "Name for the content object." ) ,
3142
+ prompt : z . string ( ) . describe ( "Prompt for image generation." ) ,
3143
+ } ,
3144
+ async ( { name, prompt } ) => {
3145
+ const client = new Graphlit ( ) ;
3146
+
3147
+ const type = ContentPublishingServiceTypes . OpenAiImage ;
3148
+ const format = ContentPublishingFormats . Png ;
3149
+ const model = OpenAiImageModels . GptImage_1 ;
3150
+
3151
+ try {
3152
+ const response = await client . publishText ( prompt , TextTypes . Plain , { type : type , format : format , openAIImage : { model : model } } , name , undefined , true ) ;
3153
+
3154
+ return {
3155
+ content : [ {
3156
+ type : "text" ,
3157
+ text : JSON . stringify ( { id : response . publishText ?. id } , null , 2 )
3158
+ } ]
3159
+ } ;
3160
+
3161
+ } catch ( err : unknown ) {
3162
+ const error = err as Error ;
3163
+ return {
3164
+ content : [ {
3165
+ type : "text" ,
3166
+ text : `Error: ${ error . message } `
3167
+ } ] ,
3168
+ isError : true
3169
+ } ;
3170
+ }
3171
+ }
3172
+ ) ;
3173
+
3132
3174
server . tool (
3133
3175
"sendWebHookNotification" ,
3134
3176
`Sends a webhook notification to the provided URL.
3135
3177
Accepts the webhook URL.
3136
3178
Also accepts the text to be sent with the webhook, and an optional text type (Plain, Markdown, Html). Defaults to Markdown text type.
3137
3179
Returns true if the notification was successfully sent, or false otherwise.` ,
3138
3180
{
3139
- url : z . string ( ) ,
3140
- text : z . string ( ) ,
3141
- textType : z . nativeEnum ( TextTypes ) . optional ( ) . default ( TextTypes . Markdown ) ,
3181
+ url : z . string ( ) . describe ( "Webhook URL." ) ,
3182
+ text : z . string ( ) . describe ( "Text to send." ) ,
3183
+ textType : z . nativeEnum ( TextTypes ) . optional ( ) . default ( TextTypes . Markdown ) . describe ( "Text type (Plain, Markdown, Html). Defaults to Markdown." ) ,
3142
3184
} ,
3143
3185
async ( { text, textType, url } ) => {
3144
3186
const client = new Graphlit ( ) ;
@@ -3175,9 +3217,9 @@ export function registerTools(server: McpServer) {
3175
3217
Requires environment variable to be configured: SLACK_BOT_TOKEN.
3176
3218
Returns true if the notification was successfully sent, or false otherwise.` ,
3177
3219
{
3178
- channelName : z . string ( ) ,
3179
- text : z . string ( ) ,
3180
- textType : z . nativeEnum ( TextTypes ) . optional ( ) . default ( TextTypes . Markdown ) ,
3220
+ channelName : z . string ( ) . describe ( "Slack channel name." ) ,
3221
+ text : z . string ( ) . describe ( "Text to send." ) ,
3222
+ textType : z . nativeEnum ( TextTypes ) . optional ( ) . default ( TextTypes . Markdown ) . describe ( "Text type (Plain, Markdown, Html). Defaults to Markdown." ) ,
3181
3223
} ,
3182
3224
async ( { text, textType, channelName } ) => {
3183
3225
const botToken = process . env . SLACK_BOT_TOKEN ;
@@ -3220,7 +3262,7 @@ export function registerTools(server: McpServer) {
3220
3262
Requires environment variables to be configured: TWITTER_CONSUMER_API_KEY, TWITTER_CONSUMER_API_SECRET, TWITTER_ACCESS_TOKEN_KEY, TWITTER_ACCESS_TOKEN_SECRET.
3221
3263
Returns true if the notification was successfully sent, or false otherwise.` ,
3222
3264
{
3223
- text : z . string ( )
3265
+ text : z . string ( ) . describe ( "Text to send." ) ,
3224
3266
} ,
3225
3267
async ( { text } ) => {
3226
3268
const consumerKey = process . env . TWITTER_CONSUMER_API_KEY ;
@@ -3287,10 +3329,10 @@ export function registerTools(server: McpServer) {
3287
3329
Requires environment variable to be configured: FROM_EMAIL_ADDRESS.
3288
3330
Returns true if the notification was successfully sent, or false otherwise.` ,
3289
3331
{
3290
- subject : z . string ( ) ,
3291
- to : z . array ( z . string ( ) ) ,
3292
- text : z . string ( ) ,
3293
- textType : z . nativeEnum ( TextTypes ) . optional ( ) . default ( TextTypes . Markdown ) ,
3332
+ subject : z . string ( ) . describe ( "Email subject." ) ,
3333
+ to : z . array ( z . string ( ) ) . describe ( "Email address(es) to send the notification to." ) ,
3334
+ text : z . string ( ) . describe ( "Text to send." ) ,
3335
+ textType : z . nativeEnum ( TextTypes ) . optional ( ) . default ( TextTypes . Markdown ) . describe ( "Text type (Plain, Markdown, Html). Defaults to Markdown." ) ,
3294
3336
} ,
3295
3337
async ( { text, textType, subject, to } ) => {
3296
3338
const from = process . env . FROM_EMAIL_ADDRESS ;
0 commit comments